如题,求一段Page Language="VB"的示例代码
大致情况如下:关于DataGrid的批量修改,根据一组查询条件从数据库中读取一批记录与DataGrid绑定,修改后,再重新写回数据库,目前数据的读取和修改已实现,先求如何将一修改后的数据写回数据库。
我想写回数据库首先就要把DataGrid中的数据逐行逐列读取出来,再用update写回去,不知道是不是这样,还是大家有更好的办法?
前台代码:
<div runat="server" id="main" visible="false" style="width:781px;height:303px; overflow:auto">
                                            <ASP:DataGrid id="DataGrid1" runat="server" Width="100%" BackColor="white" BorderColor="black" CellPadding="3" CellSpacing="0" Font-Size="9pt" AutoGenerateColumns="False" HeaderStyle-BackColor="darkred" HeaderStyle-ForeColor="white">
                                            <FooterStyle BackColor="White" ForeColor="Black" Height="25px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <EditItemStyle BackColor="#8080FF" ForeColor="#FFFF33" Wrap="False" />
                                            <SelectedItemStyle BackColor="#E7E8DA" ForeColor="Black" HorizontalAlign="Center" Wrap="False" />
                                            <AlternatingItemStyle BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False" />
                                            <ItemStyle BackColor="#FFFBFF" ForeColor="Black" Height="22px" HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False" />
                                            <HeaderStyle BackColor="#EFEFEF" Font-Bold="True" ForeColor="Black" Height="22px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                          <Columns>
                                            <asp:TemplateColumn HeaderText="编号">
                                              <ItemTemplate>
                                                <asp:Label id="lab_aa" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.STHF_aa") %>'>
                                                </asp:Label>
                                              </ItemTemplate>
                                            </asp:TemplateColumn>
                                             <asp:TemplateColumn HeaderText="是否有效">
                                              <ItemTemplate>
                                                <asp:DropDownList ID="drop_bb" runat="server" SelectedValue= '<%# DataBinder.Eval(Container, "DataItem.bb") %>' AutoPostBack="True">
                                                     <asp:ListItem Value=""></asp:ListItem>
                                                     <asp:ListItem Value="1">有效</asp:ListItem>
                                                     <asp:ListItem Value="0">无效</asp:ListItem>
                                                </asp:DropDownList>
                                              </ItemTemplate>
                                            </asp:TemplateColumn>
                                            <asp:TemplateColumn HeaderText="出生年月">
                                              <ItemTemplate>
                        <asp:DropDownList id="drp_cc" runat="server"  DataSource='<%# GetYear() %>' DataTextField="Year" DataValueField="Year" SelectedValue= '<%# DataBinder.Eval(Container, "DataItem.cc") %>' AutoPostBack="True"></asp:DropDownList>年
                        <asp:DropDownList ID="drp_dd" runat="server" SelectedValue= '<%# DataBinder.Eval(Container, "DataItem.dd") %>' AutoPostBack="True">
                            <asp:ListItem Value=""></asp:ListItem>
                            <asp:ListItem Value="1">1</asp:ListItem>
                                                    <asp:ListItem Value="2">2</asp:ListItem>
                            <asp:ListItem Value="3">3</asp:ListItem>
                                                    <asp:ListItem Value="4">4</asp:ListItem>
                            <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="9">9</asp:ListItem>
                                                    <asp:ListItem Value="10">10</asp:ListItem>
                            <asp:ListItem Value="11">11</asp:ListItem>
                                                    <asp:ListItem Value="12">12</asp:ListItem>
                        </asp:DropDownList>月
                                              </ItemTemplate>
                                            </asp:TemplateColumn>
                                            <asp:TemplateColumn HeaderText="姓名">
                                              <ItemTemplate>
                                                <asp:TextBox id="txt_ee" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.e") %>'>
                                                </asp:TextBox>
                                              </ItemTemplate>
                                            </asp:TemplateColumn>
                                          </Columns>
                                        </asp:DataGrid>
                                        </div>
                    <table runat="server" id="Table1" width="781" align="center" border="0" cellpadding="0" cellspacing="0">
                                          <tr>
                                            <td width="5%" height="30"></td>
                                            <td width="30%">
                                              <font color="#91B0F1">【</font>
                                              <asp:LinkButton ID="LinkButton1" Enabled="false" runat="server" CssClass="sxla" ValidationGroup="outsystem"></asp:LinkButton>
                                              <font color="#91B0F1">】</font>
                                            </td>
                                            <td width="30%"></td>
                                            <td width="30%">
                                              <font color="#91B0F1">【</font>
                                              <a href="javascript:window.close()" class="sxla">关闭</a>
                                              <font color="#91B0F1">】</font>
                                            </td>
                                            <td width="5%"></td>
                                         </tr>
                                       </table>求后台Page Language="VB"的示例代码怎么写,谢谢
Protected Sub lnkSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkSave.Click......End Sub

解决方案 »

  1.   

    http://blog.csdn.net/21aspnet/archive/2007/03/25/1540301.aspx 
      

  2.   

    求一段关于获取DataGrid某行某列值的代码Dim msfSTR As String
        Mrow = MSFkeep.Row
        Mcol = MSFkeep.Col   
        msfSTR = MSFkeep.TextMatrix(Mrow, Mcol)
      

  3.   

    li_1042237864:你那个是C#的,而且是GridView的,我C#没写过wxr0323:你这个什么意思啊 
      

  4.   

    这个是取编号的代码:
     Dim aa As Label = DirectCast(dgrNotice_3.Items(i).FindControl("lab_aa"),Label)