473,626 Members | 3,221 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting problem in asp.net SQL update command

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.Ole Db.OleDbExcepti on:
無值提供給 一或多個必 要參數。

Source Error:
Line 86: 'cmd.CommandTex t = "update client_list Set CLIENT_NAME
= '" & a & "' Where CLIENT_ID = 'John'"
Line 87: 'cmd.Connection = conn
Line 88: L.Text = cmd.ExecuteNonQ uery()
Line 89: conn.Close()
Line 90:
Source File: c:\inetpub\wwwr oot\CMS\UserDet ail.aspx.vb Line: 88

Stack Trace:
[OleDbException (0x80040e10):
無值提供給 一或多個必 要參數。]
System.Data.Ole Db.OleDbCommand .ExecuteCommand TextErrorHandli ng(Int32
hr)

System.Data.Ole Db.OleDbCommand .ExecuteCommand TextForSingleRe sult(tagDBPARAM S
dbParams, Object& executeResult)
System.Data.Ole Db.OleDbCommand .ExecuteCommand Text(Object&
executeResult)
System.Data.Ole Db.OleDbCommand .ExecuteCommand (CommandBehavio r
behavior, Object& executeResult)
System.Data.Ole Db.OleDbCommand .ExecuteReaderI nternal(Command Behavior
behavior, String method)
System.Data.Ole Db.OleDbCommand .ExecuteNonQuer y()
CMS.UserDetail. BUpdate_Click(O bject sender, EventArgs e) in
c:\inetpub\wwwr oot\CMS\UserDet ail.aspx.vb:88
System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)

System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()

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

=============== =My code=========== =============== =====
Private Sub BUpdate_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles BUpdate.Click
Dim DBPath As String
Dim SQLUpdate, a As String
DBPath = "C:\Inetpub\www root\CMS\cms.md b"

SQLUpdate = "Update client_list Set HKID='" & Me.TBHKID.Text &
"',CLIENT_N AME = '" & Me.TBClientName .Text & "' ,ADDRESS='" &
Me.TBAddress.Te xt & "',SEX='" & Me.DDLSex.Selec tedItem.Text &
"',TELEPHON E='" & Me.TBTelephone. Text & "',DATE_OF_BIRT H='" &
Me.TBDirth.Text & "',EMAIL='" & Me.TBEmail.Text & "' Where CLIENT_ID =
'John'" ',HKID='" & Me.TBHKID.Text & "',ADDRESS= '" & Me.TBAddress.Te xt
& "',SEX='" & Me.DDLSex.Selec tedItem.Text & "',TELEPHON E='" &
Me.TBTelephone. Text & "',DATE_OF_BIRT H='" & Me.TBDirth.Text &
"',EMAIL='" & Me.TBEmail.Text & "' "
Dim connStr As String = "Provider=micro soft.Jet.OLEDB. 4.0;Data
Source=" & DBPath & ""
Dim conn As System.Data.Ole Db.OleDbConnect ion
Dim cmd As System.Data.Ole Db.OleDbCommand

conn = New System.Data.Ole Db.OleDbConnect ion(connStr)

conn.Open()
cmd = New System.Data.Ole Db.OleDbCommand (SQLUpdate, conn)
L.Text = cmd.ExecuteNonQ uery()
conn.Close()
End Sub
=============== =============== =======

anyone can help me

THX

Jan 29 '06 #1
1 4964
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.Comm andText = sqlString
sqlCommand.Conn ection = sqlConnection

Dim ArticleID As Integer

Try

sqlConnection.O pen()
If sqlCommand.Exec uteNonQuery() > 0 Then
result = True
End If

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


<th*******@gmai l.com> wrote in message
news:11******** *************@g 14g2000cwa.goog legroups.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.Ole Db.OleDbExcepti on:
??????????????

Source Error:
Line 86: 'cmd.CommandTex t = "update client_list Set CLIENT_NAME
= '" & a & "' Where CLIENT_ID = 'John'"
Line 87: 'cmd.Connection = conn
Line 88: L.Text = cmd.ExecuteNonQ uery()
Line 89: conn.Close()
Line 90:
Source File: c:\inetpub\wwwr oot\CMS\UserDet ail.aspx.vb Line: 88

Stack Trace:
[OleDbException (0x80040e10):
??????????????]
System.Data.Ole Db.OleDbCommand .ExecuteCommand TextErrorHandli ng(Int32
hr)

System.Data.Ole Db.OleDbCommand .ExecuteCommand TextForSingleRe sult(tagDBPARAM S
dbParams, Object& executeResult)
System.Data.Ole Db.OleDbCommand .ExecuteCommand Text(Object&
executeResult)
System.Data.Ole Db.OleDbCommand .ExecuteCommand (CommandBehavio r
behavior, Object& executeResult)
System.Data.Ole Db.OleDbCommand .ExecuteReaderI nternal(Command Behavior
behavior, String method)
System.Data.Ole Db.OleDbCommand .ExecuteNonQuer y()
CMS.UserDetail. BUpdate_Click(O bject sender, EventArgs e) in
c:\inetpub\wwwr oot\CMS\UserDet ail.aspx.vb:88
System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)

System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()

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

=============== =My code=========== =============== =====
Private Sub BUpdate_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles BUpdate.Click
Dim DBPath As String
Dim SQLUpdate, a As String
DBPath = "C:\Inetpub\www root\CMS\cms.md b"

SQLUpdate = "Update client_list Set HKID='" & Me.TBHKID.Text &
"',CLIENT_N AME = '" & Me.TBClientName .Text & "' ,ADDRESS='" &
Me.TBAddress.Te xt & "',SEX='" & Me.DDLSex.Selec tedItem.Text &
"',TELEPHON E='" & Me.TBTelephone. Text & "',DATE_OF_BIRT H='" &
Me.TBDirth.Text & "',EMAIL='" & Me.TBEmail.Text & "' Where CLIENT_ID =
'John'" ',HKID='" & Me.TBHKID.Text & "',ADDRESS= '" & Me.TBAddress.Te xt
& "',SEX='" & Me.DDLSex.Selec tedItem.Text & "',TELEPHON E='" &
Me.TBTelephone. Text & "',DATE_OF_BIRT H='" & Me.TBDirth.Text &
"',EMAIL='" & Me.TBEmail.Text & "' "
Dim connStr As String = "Provider=micro soft.Jet.OLEDB. 4.0;Data
Source=" & DBPath & ""
Dim conn As System.Data.Ole Db.OleDbConnect ion
Dim cmd As System.Data.Ole Db.OleDbCommand

conn = New System.Data.Ole Db.OleDbConnect ion(connStr)

conn.Open()
cmd = New System.Data.Ole Db.OleDbCommand (SQLUpdate, conn)
L.Text = cmd.ExecuteNonQ uery()
conn.Close()
End Sub
=============== =============== =======

anyone can help me

THX
Jan 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
12471
by: David Messner | last post by:
Ok I know this is simple but the statement eludes me... I have a date field where I want the default value on the data entry form's date field to be the last date entered. I figure I can do this with a query but don't know what the criteria needs to be. Any help would be appreciated, Thanks
5
1426
by: Brian Henry | last post by:
I have a page which reads an article from the database it has 1 text box, 2 dropdown lists, and a longreat HTML text box. I load the information from the database when the page is set to edit mode from a query string action=edit, now when i click on the update button it does the update event, the problem is, it still has the old unedited data in memory... and places the old stuff back into the database (saw this when debugging) the SQL is...
4
2144
by: Jonathan Upright | last post by:
Greetings to anyone who can help: I'm using WebMatrix to make ASP.NET pages, and I chose the "Editable DataGrid" at the project selector screen. As you may know, it defaults to the Microsoft SQL database "pubs". I've followed the instructions in the comments and also changed everything pertaining to SQL over to OLEDB. (i.e. Changed SqlDbType. to OleDbType.) I also changed the datafield names and variable names accordingly. The page...
17
3812
by: Benoit Martin | last post by:
I'm working on a project in VB.net connecting to a SQL Server 2000 database that I can't modify I created a dataset with a schema identical to the DB. When trying to update the DB from the dataset using the dataAdapter.update sub, I get an error. The problem seems to be that one of the fields was named 'desc' which is a reserved word for SQL. I've been able to work around this design flaw 'till now but it looks like the update sub can't...
13
6560
by: dennis | last post by:
Hello, I'm having trouble solving the following problem with DB2 UDB 8.2. I need to create a trigger that performs certain extra constraint validations (temporal uniqueness). One of the tables has no primary key. I'm having trouble expressing an update trigger that checks for existing rows, contemporary to the updated one, but exclusing the
0
1336
by: JimN1 | last post by:
Error: Update requires a valid UpdateCommand when passed DataRow collection with modified rows. This is a continuation of my previous table element update question. I am now getting the above error message. I need help with the format of the SQLAdapter.Update(DSet.Tables(0)) command. I have included my code below. The line is in bold text. Imports System Imports System.Reflection Imports System.Text Imports System.Collections...
1
8226
by: Rafael Fernandez | last post by:
Hi folks, I have the following sql/pl: CREATE PROCEDURE DBSTG.TEST (OUT PRESULT INTEGER ) SPECIFIC DBSTG.TEST DYNAMIC RESULT SETS 1 LANGUAGE SQL
1
5177
by: Selvakumar | last post by:
hai friends, I am new to .net programming. I did the inserting data into MS-access database but i couldn't able to perform the update command. I used only textbox and command button for inserting and updating the data. I performed Insert command successfully but i donno y the update command is not working.Pls help.. i ve used all possible update commands. i enclosed all my code( comments also)... Protected Sub Button1_Click(ByVal sender...
13
8864
by: Terry Olsen | last post by:
I'm using OleDb to connect with an Access Database. I have anywhere from 10 to over 100 records that I need to either INSERT if the PK doesn't exist or UPDATE if the PK does exist, all in a single transaction. Does anyone have an SQL statement I can throw at it that would accomplish this? If I can't figure out how to do it, I'm going to have to send two discreet SQL commands for each record which will take infinitely longer than a...
0
8196
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1808
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.