getting problem in asp.net SQL update command

T

thangchan

Hi all,
i am getting SQL update problem. as below

======================error messages =======================
Server Error in '/CMS' Application.
--------------------------------------------------------------------------------

無值æ供給一或多個必è¦åƒæ•¸ã€‚
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException:
無值æ供給一或多個必è¦åƒæ•¸ã€‚

Source Error:


Line 86: 'cmd.CommandText = "update client_list Set CLIENT_NAME
= '" & a & "' Where CLIENT_ID = 'John'"
Line 87: 'cmd.Connection = conn
Line 88: L.Text = cmd.ExecuteNonQuery()
Line 89: conn.Close()
Line 90:


Source File: c:\inetpub\wwwroot\CMS\UserDetail.aspx.vb Line: 88

Stack Trace:


[OleDbException (0x80040e10):
無值æ供給一或多個必è¦åƒæ•¸ã€‚]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr)

System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
CMS.UserDetail.BUpdate_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\CMS\UserDetail.aspx.vb:88
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

==============================================================

================My code===============================
Private Sub BUpdate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BUpdate.Click
Dim DBPath As String
Dim SQLUpdate, a As String
DBPath = "C:\Inetpub\wwwroot\CMS\cms.mdb"

SQLUpdate = "Update client_list Set HKID='" & Me.TBHKID.Text &
"',CLIENT_NAME = '" & Me.TBClientName.Text & "' ,ADDRESS='" &
Me.TBAddress.Text & "',SEX='" & Me.DDLSex.SelectedItem.Text &
"',TELEPHONE='" & Me.TBTelephone.Text & "',DATE_OF_BIRTH='" &
Me.TBDirth.Text & "',EMAIL='" & Me.TBEmail.Text & "' Where CLIENT_ID =
'John'" ',HKID='" & Me.TBHKID.Text & "',ADDRESS='" & Me.TBAddress.Text
& "',SEX='" & Me.DDLSex.SelectedItem.Text & "',TELEPHONE='" &
Me.TBTelephone.Text & "',DATE_OF_BIRTH='" & Me.TBDirth.Text &
"',EMAIL='" & Me.TBEmail.Text & "' "


Dim connStr As String = "Provider=microsoft.Jet.OLEDB.4.0;Data
Source=" & DBPath & ""
Dim conn As System.Data.OleDb.OleDbConnection
Dim cmd As System.Data.OleDb.OleDbCommand

conn = New System.Data.OleDb.OleDbConnection(connStr)

conn.Open()
cmd = New System.Data.OleDb.OleDbCommand(SQLUpdate, conn)
L.Text = cmd.ExecuteNonQuery()
conn.Close()
End Sub
=====================================

anyone can help me

THX
 
M

Mr Newbie

Enclose your code in a Try Catch Block something like this. Set a breakpoint
before this point and execute line by line until you get the exception, when
you do follow it into the exception block and check the value of the message
of the exception, this should give you more information. ?

SqlCommand.CommandText = sqlString
sqlCommand.Connection = sqlConnection

Dim ArticleID As Integer

Try

sqlConnection.Open()
If sqlCommand.ExecuteNonQuery() > 0 Then
result = True
End If

Catch ex As Exception
result = False
Finally
sqlConnection.Close()
End Try
--
Terry Burns
http://TrainingOn.net






Hi all,
i am getting SQL update problem. as below

======================error messages =======================
Server Error in '/CMS' Application.
--------------------------------------------------------------------------------

??????????????
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException:
??????????????

Source Error:


Line 86: 'cmd.CommandText = "update client_list Set CLIENT_NAME
= '" & a & "' Where CLIENT_ID = 'John'"
Line 87: 'cmd.Connection = conn
Line 88: L.Text = cmd.ExecuteNonQuery()
Line 89: conn.Close()
Line 90:


Source File: c:\inetpub\wwwroot\CMS\UserDetail.aspx.vb Line: 88

Stack Trace:


[OleDbException (0x80040e10):
??????????????]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr)

System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
CMS.UserDetail.BUpdate_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\CMS\UserDetail.aspx.vb:88
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

==============================================================

================My code===============================
Private Sub BUpdate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BUpdate.Click
Dim DBPath As String
Dim SQLUpdate, a As String
DBPath = "C:\Inetpub\wwwroot\CMS\cms.mdb"

SQLUpdate = "Update client_list Set HKID='" & Me.TBHKID.Text &
"',CLIENT_NAME = '" & Me.TBClientName.Text & "' ,ADDRESS='" &
Me.TBAddress.Text & "',SEX='" & Me.DDLSex.SelectedItem.Text &
"',TELEPHONE='" & Me.TBTelephone.Text & "',DATE_OF_BIRTH='" &
Me.TBDirth.Text & "',EMAIL='" & Me.TBEmail.Text & "' Where CLIENT_ID =
'John'" ',HKID='" & Me.TBHKID.Text & "',ADDRESS='" & Me.TBAddress.Text
& "',SEX='" & Me.DDLSex.SelectedItem.Text & "',TELEPHONE='" &
Me.TBTelephone.Text & "',DATE_OF_BIRTH='" & Me.TBDirth.Text &
"',EMAIL='" & Me.TBEmail.Text & "' "


Dim connStr As String = "Provider=microsoft.Jet.OLEDB.4.0;Data
Source=" & DBPath & ""
Dim conn As System.Data.OleDb.OleDbConnection
Dim cmd As System.Data.OleDb.OleDbCommand

conn = New System.Data.OleDb.OleDbConnection(connStr)

conn.Open()
cmd = New System.Data.OleDb.OleDbCommand(SQLUpdate, conn)
L.Text = cmd.ExecuteNonQuery()
conn.Close()
End Sub
=====================================

anyone can help me

THX
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top