string ID = Gdv2.DataKeys[e.RowIndex].Value.ToString();
string _Name = ((TextBox)(Gdv2.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim();
float _Number = float.Parse (((TextBox)(Gdv2.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim());
string _Mark = ((TextBox)(Gdv2.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
string sqlStr = "update Prod set Name='" + _Name + "',Number='" + _Number + "',Mark='" + _Mark + "' where Code='" + ID + "'";
Common.ExecuteSql(sqlStr);UPDATE 语句的语法错误 语句在sql中可以执行呀
是什么原因啊 请帮下忙
解决方案 »
- * Copyright (C) 2012 明振居士 版权没有,任意拷贝及使用,但对使用造成的任何后果不负任何责任,互相开源影响,共同进步
- 我要统计按层次分组的数据,要怎么实现?
- sql产生一列连续数字
- C#中多窗体控制问题?
- <![CDATA[研究]]>
- 请教界面设计问题
- 在richtextbox中使用richtextbox.lines[number]的办法操作每行的字符串遇到的问题
- Teched2004最后两天下载,同时新加熊老的teched录像,请尽快下载。
- 怎样使一个窗体位于另一窗体的上方?
- Visual Studio.NET的开发环境为什么这么差!经常无法弹出自动完成窗口
- 问一个白痴的XML问题,
- 如何刷新ToolStriptMenuItem的DropDownItmes
把sqlStr 显示出来
{
string ID = Gdv2.DataKeys[e.RowIndex].Value.ToString();
string _Name = ((TextBox)(Gdv2.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim();
float _Number = float.Parse (((TextBox)(Gdv2.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim());
string _Mark = ((TextBox)(Gdv2.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
string sqlStr = "update Prod set Name='" + _Name + "',Number=" + _Number + ",Mark='" + _Mark + "' where Code='" + ID + "'";
Common.ExecuteSql(sqlStr);
Gdv2.EditIndex = -1;
bind();
}即时窗口
?sqlStr
"update Prod set Name='nce',Number=21,Mark='awfwf' where Code='001'"UPDATE 语句的语法错误。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Exception: UPDATE 语句的语法错误。源错误: 行 77: catch (Exception e)
行 78: {
行 79: throw new Exception(e.Message);
行 80: }
行 81: finally
源文件: E:\myweb\Firstdata\Firstdata\Common.cs 行: 79 堆栈跟踪: [Exception: UPDATE 语句的语法错误。]
Common.ExecuteSql(String sqlStr) in E:\myweb\Firstdata\Firstdata\Common.cs:79
Firstdata.Edit.Gdv2_RowUpdating(Object sender, GridViewUpdateEventArgs e) in E:\myweb\Firstdata\Firstdata\Edit.aspx.cs:58
System.Web.UI.WebControls.GridView.OnRowUpdating(GridViewUpdateEventArgs e) +133
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +720
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +704
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +123
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
谢谢大家