日期:2014-05-17  浏览次数:20416 次

DataView控件
各位大神 求教下怎么把数据库里面的数据 添加到DataView里面去 我用的vs2005 前台代码如下:
<table style="margin:10px 20px">
  <asp:ScriptManager id="ScriptManager1" runat="server">
  </asp:ScriptManager> 
  <tr>
  <td>店柜代码:
  <asp:TextBox ID="strecode" runat="server"></asp:TextBox>
  &nbsp;&nbsp;
  <button id="chax" runat="server" class="btn3_mouseout" onmouseover="this.className='btn3_mouseover'" onmouseout="this.className='btn3_mouseout'" onmousedown="this.className='btn3_mousedown'" onmouseup="this.className='btn3_mouseup'" style="width: 80px; height: 25px;" onserverclick="save_ServerClick">查询</button>
  &nbsp;&nbsp;
  <%--<button id="del" runat="server" class="btn3_mouseout" onmouseover="this.className='btn3_mouseover'" onmouseout="this.className='btn3_mouseout'" onmousedown="this.className='btn3_mousedown'" onmouseup="this.className='btn3_mouseup'" style="width: 80px; height: 25px;" onserverclick="del_ServerClick">删除</button>
  </td>--%>
  </tr>
  <tr>
   
  <td style="height: 416px; width:500px">
  <hr style="size:0; height:0;"/><br />
  <asp:Panel ID="Panel1" runat="server" Width="100%" Height="400px" ScrollBars="Vertical" >
  <asp:UpdatePanel id="UpdatePanel2" runat="server">
  <ContentTemplate>
  <asp:DataGrid ID="DataGrid1" runat="server" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" DataKeyField="usercode" Width="100%">
  <Columns>
  <asp:ButtonColumn CommandName="Select" Text="选择">
  <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
  Font-Underline="False" Wrap="False" />
  <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
  Font-Underline="False" Wrap="False" />
  </asp:ButtonColumn>
  <asp:BoundColumn DataField="storecode" HeaderText="店柜代码" SortExpression="ColorCode">
  <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
  Font-Underline="False" Wrap="False" />
  <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
  Font-Underline="False" Wrap="False" />
  </asp:BoundColumn>
  <asp:BoundColumn DataField="transdate" HeaderText="时间" SortExpression="ColorCode">
  <HeaderStyle Font-