插一个NULL进去不就可以了吗?

解决方案 »

  1.   

    http://dotnet.aspx.cc/ShowDetail.aspx?id=B12283DE-DB20-4322-ACCC-12724442808A
      

  2.   

    <%@ Page Language="VB" %>
    <script runat="server">    ' Insert page code here
              '
        '''''''''''''''''''''''datalist pagination code''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
              Sub BindList(PageNo as Integer)
        
              Dim MyTable As DataTable=CreateDataSet("select * from YongHu", "mm", "YongHu").tables("YongHu")
              Dim TotalRecord=MyTable.rows.count
              Label1.text=TotalRecord
        
              dim TotalPage as Integer
        
                IF TotalRecord < DropDownList2.SelectedItem.Value THEN
        
                   TotalPage=1
        
                ELSE
        
                    IF TotalRecord Mod DropDownList2.SelectedItem.Value <>0 THEN
        
                         TotalPage =TotalRecord\DropDownList2.SelectedItem.Value+1
        
                    ELSE
        
                         TotalPage =TotalRecord/DropDownList2.SelectedItem.Value
        
                    END IF
        
                END IF
             label2.text= TotalPage
        
        
             Dim TempTable as DataTable=MyTable.Clone()
        
             Dim i ,j as integer
        
        
                 For I=(PageNo-1) * DropDownList2.SelectedItem.Value to PageNo*DropDownList2.SelectedItem.Value-1
        
                 If I> myTable.Rows.Count-1 Then Exit for
        
                    Dim newRow as DataRow=TempTable.NewRow()
        
                    For J=0 TO MyTable.Columns.Count-1
        
                      newRow(MyTable.Columns(j).ColumnName)=MyTable.Rows(I).Item(j)
        
                    Next
        
                    TempTable.Rows.Add(NewRow)
        
                 Next
        
               DataList1.datasource=TempTable
               DataList1.databind()
        
              End Sub
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        
        
        
           ''''''''page the frist load''''''''''''''''''''''''''''''''''''''''''''''''
             Sub Page_Init(sender As Object, e As EventArgs)
        
             BindList(1)
             PageListItem()
             ShowWhatButton()
        
             End Sub
        
           '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        
            '''''''''''''''''insert DropDownlist pageRecord'''''''''''''''''''''''''
             Sub PageListItem()
             Dim I as Integer
             DropDownList1.Items.Clear()
             For I=0 To label2.text-1
                 DropDownList1.Items.add(i+1)
             next
             End Sub
              '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        
        
        
              '''''''''''''''''change PageRecord'''''''''''''''''''''
             Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs)
             Bindlist(DropDownList1.SelectedIndex+1)
             End Sub
      

  3.   

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        
           Sub DropDownList2_SelectedIndexChanged(sender As Object, e As EventArgs)
        
            DropDownList1.SelectedIndex=0
            BindList(DropDownList1.SelectedIndex+1)
            PageListItem()
            ShowWhatButton()
            End Sub
        
        
          '''''''show linkbutton ( next or previous )'''''''''''''''''''''''''''''''''''''''''''''''''''
           Sub LinkButton1_Click(sender As Object, e As EventArgs)
             DropDownList1.SelectedIndex=0
             Bindlist(DropDownList1.SelectedIndex+1)
             ShowWhatButton()
           End Sub
        
            Sub LinkButton2_Click_1(sender As Object, e As EventArgs)
        
        
             DropDownList1.SelectedIndex=DropDownList1.SelectedIndex+1
             Bindlist(DropDownList1.SelectedIndex+1)
             ShowWhatButton()
        
             End Sub
        
        Sub LinkButton3_Click_1(sender As Object, e As EventArgs)
        
             DropDownList1.SelectedIndex=DropDownList1.SelectedIndex-1
             Bindlist(DropDownList1.SelectedIndex+1)
             ShowWhatButton()
             End Sub
        
            Sub LinkButton4_Click_1(sender As Object, e As EventArgs)
             DropDownList1.SelectedIndex=Label2.text-1
             Bindlist(DropDownList1.SelectedIndex+1)
             ShowWhatButton()
             End Sub
             '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        
        
             Sub ShowWhatButton()
             IF DropDownList1.SelectedIndex=0 THEN
        
                LinkButton3.Enabled=False
        
             ELSE
        
                LinkButton3.Enabled=True
        
             END IF
        
        
            IF DropDownList1.SelectedIndex=Label2.text-1 THEN
        
                LinkButton2.Enabled=False
        
             ELSE
        
                LinkButton2.Enabled=True
        
             END IF
        
            End Sub</script>
    <html>
    <head>
        <!-- #include File="SqlFunction.inc" -->
    </head>
    <body>
        <form runat="server">
            <p>
            </p>
            <table width="760" border="1">
                <tbody>
                    <tr>
                        <td height="220">
                            <table height="220" width="200" border="1">
                                <tbody>
                                    <tr>
                                        <td height="208">
                                            <asp:DataList id="DataList1" runat="server" Width="101px" Height="101px" BackColor="White" BorderStyle="Double" GridLines="Horizontal" BorderWidth="3px" BorderColor="#336666" CellPadding="4">
                                                <ItemStyle forecolor="#333333" backcolor="White"></ItemStyle>
                                                <FooterStyle forecolor="#333333" backcolor="White"></FooterStyle>
                                                <HeaderStyle font-bold="True" forecolor="White" backcolor="#336666"></HeaderStyle>
                                                <SelectedItemStyle font-bold="True" forecolor="White" backcolor="#339966"></SelectedItemStyle>
                                                <ItemTemplate>
                                                    <table width="300">
                                                        <tbody>
                                                            <tr>
                                                                <td>
                                                                    <%# container.dataitem("XingMing")%> 
                                                                </td>
                                                                <td></td>
                                                                <td></td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </ItemTemplate>
                                            </asp:DataList>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table width="750" border="1">
                                <tbody>
                                    <tr>
                                        <td width="630">
                                            <div style="FONT-SIZE: smaller" align="left">TotalRecorD: <asp:Label id="Label1" runat="server">Label</asp:Label>&nbsp;||&nbsp;TotalPage:&nbsp;<asp:Label id="Label2" runat="server">Label</asp:Label>&nbsp;||
                                                C<a target="FrameBody">urrentPage</a>: 
                                                <asp:DropDownList id="DropDownList1" runat="server" BackColor="PaleGreen" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" Font-Size="Smaller"></asp:DropDownList>
                                                &nbsp;||&nbsp;PerPageRecord: 
                                                <asp:DropDownList id="DropDownList2" runat="server" BackColor="PaleGreen" AutoPostBack="True" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged" Font-Size="Smaller">
                                                    <asp:ListItem Value="5">5</asp:ListItem>
                                                    <asp:ListItem Value="6">6</asp:ListItem>
                                                    <asp:ListItem Value="7">7</asp:ListItem>
                                                    <asp:ListItem Value="8">8</asp:ListItem>
                                                    <asp:ListItem Value="50">50</asp:ListItem>
                                                </asp:DropDownList>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div style="FONT-SIZE: smaller" align="left">
                                            </div>
                                            <div align="left">
                                            </div>
                                            <div align="left">
                                            </div>
                                            <div align="left">
                                            </div>
                                            <div align="left">
                                            </div>
                                            <div align="left">
                                            </div>
                                            <div align="right">
                                                <asp:LinkButton id="LinkButton1" onclick="LinkButton1_Click" runat="server" Font-Size="Smaller">Frist</asp:LinkButton>
                                                &nbsp;&nbsp;<asp:LinkButton id="LinkButton2" onclick="LinkButton2_Click_1" runat="server" Font-Size="Smaller">Next</asp:LinkButton>
                                                &nbsp; 
                                                <asp:LinkButton id="LinkButton3" onclick="LinkButton3_Click_1" runat="server" Font-Size="Smaller">Previous</asp:LinkButton>
                                                &nbsp; 
                                                <asp:LinkButton id="LinkButton4" onclick="LinkButton4_Click_1" runat="server" Font-Size="Smaller">Last</asp:LinkButton>
                                            </div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                </tbody>
            </table>
            <div align="right">
            </div>
        </form>
    </body>
    </html>
      

  4.   

    回答你顺便问的问题把:
    把字段的默认值设为(getdate())就行了