输入字符串的格式不正确。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.FormatException: 输入字符串的格式不正确。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪:
[FormatException: 输入字符串的格式不正确。]
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +0
Lx.Sinaqd.Active.Admin.update_Click(Object Sender, DataGridCommandEventArgs e) +71
System.Web.UI.WebControls.DataGrid.OnUpdateCommand(DataGridCommandEventArgs e) +109
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e) +507
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e) +100
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +120
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +115
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138
System.Web.UI.Page.ProcessRequestMain() +1277
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.FormatException: 输入字符串的格式不正确。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪:
[FormatException: 输入字符串的格式不正确。]
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +0
Lx.Sinaqd.Active.Admin.update_Click(Object Sender, DataGridCommandEventArgs e) +71
System.Web.UI.WebControls.DataGrid.OnUpdateCommand(DataGridCommandEventArgs e) +109
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e) +507
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e) +100
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +120
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +115
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138
System.Web.UI.Page.ProcessRequestMain() +1277
解决方案 »
- TreeView控件的使用
- uploadify超过1M的文件上传不成功
- @在parameter中的用处是什么?
- gridview无法更新,已经开了3贴了
- 能弹出这两种对话柜吗?
- 在win2003上vs.net2005远程调试问题
- 你能解决这个问题吗?很难哦!分数很高哦:99
- 如何取消提<a>控件的跳转
- 如何将每次查询的结果填充到datagrid并自动累计和合计?
- socket编程:接受方把收到字节数组转化为 byteBuffer,byteBuffer转化为charBuffer时,charBuffer为空?
- 旧题重提,我查看了许多使用ASP.NET访问注册表的帖子,但是还是不能解决问题!请大家帮帮我,100分相送!
- 如何将数据写入.txt文本文件?
在组合sql语句的时候,最好使用参数向sql command中传递参数,例如先声明connection和adapter
string strSql ="";
strSql = " update cec.TBL_ORDER;"
strSql += " set PAYFLAG = '1' ";
strSql += " ,UPDATEDATE = @UPDATEDATE ";
strSql += " where ID = @ORDERID ";try
{
objAdapter = new SqlDataAdapter();
objAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; objAdapter.UpdateCommand = new SqlCommand(strSql,conn); objAdapter.UpdateCommand.Parameters.Add("@ORDERID",SqlDbType.Int).Value = Convert.ToInt32(merchId); objAdapter.UpdateCommand.Parameters.Add("@UPDATEDATE",SqlDbType.DateTime).Value =DateTime.Now; objAdapter.UpdateCommand.ExecuteNonQuery();
}
catch(Exception err)
{
...这样不会出现数据库字段类型不匹配的错误
"UPDATE Activity SET auditing='"+isPb+"',auditingcategory='"+import+"' WHERE ID='"+id+"'"或者你单步调试一下看哪句出错
MyDb.NonQuery("UPDATE Activity SET auditing='"+isPb+"',auditingcategory='"+import+"' WHERE ID='"+id+"'");
id=Convert.ToInt32(e.Item.Cells[0].Text);
这里可能转换有问题
e.Item.Cells[0].Text
LoadGrid();
这句也让我注掉了,直接让id=一个数了,可是还出现同样的问题.
-------------------------------------------------------------
输入字符串的格式不正确。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.FormatException: 输入字符串的格式不正确。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪:
[FormatException: 输入字符串的格式不正确。]
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +0
Lx.Sinaqd.Active.Admin.update_Click(Object Sender, DataGridCommandEventArgs e) +71
System.Web.UI.WebControls.DataGrid.OnUpdateCommand(DataGridCommandEventArgs e) +109
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e) +507
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e) +100
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +120
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +115
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138
System.Web.UI.Page.ProcessRequestMain() +1277--------------------------------------------------
id=Convert.ToInt32(e.Item.Cells[0].Text);
CheckBox Pb=(CheckBox)e.Item.Cells[3].Controls[0];
CheckBox Imp=(CheckBox)e.Item.Cells[4].Controls[0];
这三行都不对,可应该怎么写呢?
id=Convert.ToInt32(e.Item.Cells[0].Text);
CheckBox Pb=(CheckBox)e.Item.Cells[3].Controls[0];
CheckBox Imp=(CheckBox)e.Item.Cells[4].Controls[0];就是这三行代码不对,全都有是索引的事,
可是我还是不明白,为什么Controls[0];不行,改成Controls[1];就好了呢,可每个<editItemTeplate>里面只有一个checkbox啊.