sqlstr ="update company set cname='"+cname.Text+"'.... where id='"+id+"'"; 谢谢高手的回复,我查检查过了,没写错,因为太多字段了,我删掉很多,拷上来贴贴的时候拷漏了。
提交之后显示的错误是这样的,我做的另一个修改页面也是用这种方法去做的可以修改成功,真搞不懂是怎么回事,是不是跟数据库设置有关呢?请大家帮帮我这个笨菜鸟了谢谢大家。Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off". <!-- Web.Config Configuration File --><configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration> Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL. <!-- Web.Config Configuration File --><configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration>
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File --><configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File --><configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
dr=mycomm.ExecuteReader();
if(dr.Read())
{
user_city.Text= dr["user_city"].ToString();
jianj.Text = dr["jianj"].ToString();
}
dr.Close();//用完之后,IDataReader必须关闭
myconn.Close();
行 116:
行 117: myconn.Open();
行 118: mycomm.ExecuteNonQuery();
行 119: myconn.Close();
行 120: Response.Write("<script language='JavaScript'>alert('操作已成功!');window.location.href='update.aspx';</"+"script>");
源文件: c:\inetpub\wwwroot\company\update.aspx.cs 行: 118 堆栈跟踪:
[SqlException: 第 1 行: '5534' 附近有语法错误。]
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +180
company.update.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\company\update.aspx.cs:118
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277