By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,877 Members | 1,102 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,877 IT Pros & Developers. It's quick & easy.

getting problem in asp.net SQL update command

P: n/a
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.ExecuteCommandTextE rrorHandling(Int32
hr)

System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object&
executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior
behavior, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(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.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection 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

Jan 29 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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


<th*******@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
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.ExecuteCommandTextE rrorHandling(Int32
hr)

System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object&
executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior
behavior, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(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.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection 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
Jan 29 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.