问题描述
如图所示,输入条件查询后,结果出来了,但编辑后无法更新,小白刚学,求赐教;<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default2.aspx.cs"Inherits="Default2"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title></head><body><formid="form1"runat="server"><div><divid="attdatetitle">输入查询条件:</div><br/><br/>UID:<asp:TextBoxID="selectname"runat="server"></asp:TextBox><asp:ButtonID="Button1"runat="server"Text="查询"OnClick="Button1_Click"/><divid="attdate"><asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ConnectionStrings:MiaConnectionString1%>"ProviderName="<%$ConnectionStrings:MiaConnectionString1.ProviderName%>"SelectCommand="SELECTsbbm,sbtc,ejdw,sybm,bgrzh,bgrmz,glzt,zpjg,bz,fpjg,gxbgr,gxmip,gxsybm,zcidFROMMideazcWHERE(sbbm=@sbbm)"UpdateCommand="UPDATE[Mideazc]SET[sbbm]=@sbbm,[sbtc]=@sbtc,[ejdw]=@ejdw,[sybm]=@sybm,[bgrzh]=@bgrzh,[bgrmz]=@bgrmz,[glzt]=@glzt,[zpjg]=@zpjg,[bz]=@bz,[fpjg]=@fpjg,[gxbgr]=@gxbgr,[gxmip]=@gxmip,[gxsybm]=@gxsybmWHERE[zcid]=@original_zcid"><UpdateParameters><asp:ParameterName="sbbm"Type="String"/><asp:ParameterName="sbtc"Type="String"/><asp:ParameterName="ejdw"Type="String"/><asp:ParameterName="sybm"Type="String"/><asp:ParameterName="bgrzh"Type="String"/><asp:ParameterName="bgrmz"Type="String"/><asp:ParameterName="glzt"Type="String"/><asp:ParameterName="zpjg"Type="String"/><asp:ParameterName="bz"Type="String"/><asp:ParameterName="fpjg"Type="String"/><asp:ParameterName="gxbgr"Type="String"/><asp:ParameterName="gxmip"Type="String"/><asp:ParameterName="gxsybm"Type="String"/><asp:ParameterName="original_zcid"Type="Int32"/></UpdateParameters><SelectParameters><asp:ControlParameterControlID="selectname"Name="sbbm"PropertyName="Text"Type="String"/></SelectParameters></asp:SqlDataSource></div></div><asp:DetailsViewID="DetailsView1"runat="server"AutoGenerateRows="False"DataKeyNames="zcid"DataSourceID="SqlDataSource1"Height="50px"Width="125px"><Fields><asp:BoundFieldDataField="sbbm"HeaderText="sbbm"SortExpression="sbbm"/><asp:BoundFieldDataField="sbtc"HeaderText="sbtc"SortExpression="sbtc"/><asp:BoundFieldDataField="ejdw"HeaderText="ejdw"SortExpression="ejdw"/><asp:BoundFieldDataField="sybm"HeaderText="sybm"SortExpression="sybm"/><asp:BoundFieldDataField="bgrzh"HeaderText="bgrzh"SortExpression="bgrzh"/><asp:BoundFieldDataField="bgrmz"HeaderText="bgrmz"SortExpression="bgrmz"/><asp:BoundFieldDataField="glzt"HeaderText="glzt"SortExpression="glzt"/><asp:BoundFieldDataField="zpjg"HeaderText="zpjg"SortExpression="zpjg"/><asp:BoundFieldDataField="bz"HeaderText="bz"SortExpression="bz"/><asp:BoundFieldDataField="fpjg"HeaderText="fpjg"SortExpression="fpjg"/><asp:BoundFieldDataField="gxbgr"HeaderText="gxbgr"SortExpression="gxbgr"/><asp:BoundFieldDataField="gxmip"HeaderText="gxmip"SortExpression="gxmip"/><asp:BoundFieldDataField="gxsybm"HeaderText="gxsybm"SortExpression="gxsybm"/><asp:BoundFieldDataField="zcid"HeaderText="zcid"InsertVisible="False"ReadOnly="True"SortExpression="zcid"/><asp:CommandFieldShowEditButton="True"/></Fields></asp:DetailsView></form></body></html>
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;publicpartialclassDefault2:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){}protectedvoidButton1_Click(objectsender,EventArgse){}}
解决方案
解决方案二:
编辑后你写更新的代码了吗?
解决方案三:
跟着教程初学的,能给个思路引导一下吗?谢谢!