各位大虾请指教.
输入字符串的格式不正确。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.FormatException: 输入字符串的格式不正确。源错误:
行 877: Dim returnVal As Integer
行 878:
行 879: returnVal = command.ExecuteNonQuery()
行 880:
行 881: If mustCloseConnection Then
源文件: D:\Program Files\GotDotNet\DAABAF 3.1\VB\GotDotNet.ApplicationBlocks.Data\AdoHelper.vb 行: 879 堆栈跟踪:
[FormatException: 输入字符串的格式不正确。]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +194
GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(IDbCommand command) in D:\Program Files\GotDotNet\DAABAF 3.1\VB\GotDotNet.ApplicationBlocks.Data\AdoHelper.vb:879
GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(IDbConnection connection, CommandType commandType, String commandText, IDataParameter[] commandParameters) in D:\Program Files\GotDotNet\DAABAF 3.1\VB\GotDotNet.ApplicationBlocks.Data\AdoHelper.vb:1023
GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, IDataParameter[] commandParameters) in D:\Program Files\GotDotNet\DAABAF 3.1\VB\GotDotNet.ApplicationBlocks.Data\AdoHelper.vb:927
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) in D:\Program Files\GotDotNet\DAABAF 3.1\VB\Microsoft.ApplicationBlocks.Data\SqlHelper.vb:142
TestDAAB._Default.DataGrid1_UpdateCommand(Object source, DataGridCommandEventArgs e) in F:\wwwroot\TestDAAB\Default.aspx.vb:68
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) +106
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +121
System.Web.UI.WebControls.Button.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) +33
System.Web.UI.Page.ProcessRequestMain() +1277
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573
部分的源代码如下:
Imports System
Imports System.Data
Imports System.Data.SqlClientImports GotDotNet.ApplicationBlocks.Data
Imports Microsoft.ApplicationBlocks.DataPublic Class _Default
Inherits System.Web.UI.Page#Region " Web 窗体设计器生成的代码 " '该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid '注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub#End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
BindData()
End If End Sub
Public ReadOnly Property ConnectionString() As String
Get
Return ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_SqlConnectionString")
End Get
End Property
Public Sub BindData()
Dim SqlHelper As SqlHelper
DataGrid1.DataSource = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, "sp_Accounts_GetAllUsers")
DataGrid1.DataKeyField = "UserID"
DataGrid1.DataBind()
End Sub
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
DataGrid1.EditItemIndex = e.Item.ItemIndex
BindData()
End Sub
Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.UpdateCommand Dim storedParams(1) As SqlParameter
storedParams = SqlHelperParameterCache.GetSpParameterSet(ConnectionString, "sp_Accounts_UpdateUserTest") storedParams(0).Value = DataGrid1.DataKeys(e.Item.ItemIndex)
storedParams(1).Value = CType(e.Item.Cells(1).Controls(0), TextBox).Text SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, "sp_Accounts_UpdateUserTest", storedParams) DataGrid1.EditItemIndex = -1
BindData()
End Sub
输入字符串的格式不正确。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.FormatException: 输入字符串的格式不正确。源错误:
行 877: Dim returnVal As Integer
行 878:
行 879: returnVal = command.ExecuteNonQuery()
行 880:
行 881: If mustCloseConnection Then
源文件: D:\Program Files\GotDotNet\DAABAF 3.1\VB\GotDotNet.ApplicationBlocks.Data\AdoHelper.vb 行: 879 堆栈跟踪:
[FormatException: 输入字符串的格式不正确。]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +194
GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(IDbCommand command) in D:\Program Files\GotDotNet\DAABAF 3.1\VB\GotDotNet.ApplicationBlocks.Data\AdoHelper.vb:879
GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(IDbConnection connection, CommandType commandType, String commandText, IDataParameter[] commandParameters) in D:\Program Files\GotDotNet\DAABAF 3.1\VB\GotDotNet.ApplicationBlocks.Data\AdoHelper.vb:1023
GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, IDataParameter[] commandParameters) in D:\Program Files\GotDotNet\DAABAF 3.1\VB\GotDotNet.ApplicationBlocks.Data\AdoHelper.vb:927
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) in D:\Program Files\GotDotNet\DAABAF 3.1\VB\Microsoft.ApplicationBlocks.Data\SqlHelper.vb:142
TestDAAB._Default.DataGrid1_UpdateCommand(Object source, DataGridCommandEventArgs e) in F:\wwwroot\TestDAAB\Default.aspx.vb:68
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) +106
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +121
System.Web.UI.WebControls.Button.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) +33
System.Web.UI.Page.ProcessRequestMain() +1277
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573
部分的源代码如下:
Imports System
Imports System.Data
Imports System.Data.SqlClientImports GotDotNet.ApplicationBlocks.Data
Imports Microsoft.ApplicationBlocks.DataPublic Class _Default
Inherits System.Web.UI.Page#Region " Web 窗体设计器生成的代码 " '该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid '注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub#End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
BindData()
End If End Sub
Public ReadOnly Property ConnectionString() As String
Get
Return ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_SqlConnectionString")
End Get
End Property
Public Sub BindData()
Dim SqlHelper As SqlHelper
DataGrid1.DataSource = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, "sp_Accounts_GetAllUsers")
DataGrid1.DataKeyField = "UserID"
DataGrid1.DataBind()
End Sub
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
DataGrid1.EditItemIndex = e.Item.ItemIndex
BindData()
End Sub
Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.UpdateCommand Dim storedParams(1) As SqlParameter
storedParams = SqlHelperParameterCache.GetSpParameterSet(ConnectionString, "sp_Accounts_UpdateUserTest") storedParams(0).Value = DataGrid1.DataKeys(e.Item.ItemIndex)
storedParams(1).Value = CType(e.Item.Cells(1).Controls(0), TextBox).Text SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, "sp_Accounts_UpdateUserTest", storedParams) DataGrid1.EditItemIndex = -1
BindData()
End Sub
解决方案 »
- jquery 简单问题
- 如何自定义404错误页面
- ClientScript.RegisterStartupScript 和RegisterStartupScript 有啥区别啊
- 利用JavaScript动态增加表格行,对于增加的行中控件的值如何获取并计算?
- Xml 能实现这种方式吗?带图,高手请进,速度结帖!
- 如何在方法里调用具有Sender和e参数的事件
- ASP.NET调用eWebEditor的安全问题,请各位指点
- VS2003新建web运用程序时,提示奇怪错误。
- C# 怎么在Excel 中插入图片?
- 请各位高手帮助: 这个数据库连接的程序片断,到底哪里有问题?
- 一个对web.config的配置的疑问 请高手帮忙 谢谢!!!
- 求HTML高手讲解!
CType(e.Item.Cells(1).Controls(1), TextBox).Text
一个是UserID, 另外一个是Name, 没有在列里面绑定任何的控件。UserID为属性为只读