471,337 Members | 1,162 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Update Query

lea

i got this error msg while i trying to run the UPDATE query.there is n
underlying..

ERROR MSG :An unhandled exception of typ
'System.Data.OleDb.OleDbException' occurred in system.data.dll

----------------------------------------------------------------------------------------------------------------------------------------------------

CODE
Dim strSQL As String
strSQL = "UPDATE Item Master SET " & _
"Barcode = '" & txtBarcode.Text & "', Description= '"
txtItemDescription.Text & "', StandardCost= '" & txtStandardCost.Text
"', " & _
"RetailPrice= '" & txtRetailPrice.Text & "'
MinSellingPrice='" & txtMinSellingPrice.Text & "', StockQty ='"
txtStockQty.Text & "', " & _
"StockReorderLevel='" & txtStockReorder.Text & "' WHER
ItemCode = '" & txtItemCode.Text & "'"

Dim db As New OleDbCommand(strSQL, dc)
dc.Open()
db.ExecuteNonQuery()
MessageBox.Show("Record has been update successfully!", "Ite
Master", MessageBoxButtons.OK, MessageBoxIcon.Information

--
le
-----------------------------------------------------------------------
lea's Profile: http://www.msusenet.com/member.php?userid=156
View this thread: http://www.msusenet.com/t-187051013

Jul 21 '05 #1
2 1166
"lea" <le********@no-mx.msusenet.com> wrote in message
news:le********@no-mx.msusenet.com...

i got this error msg while i trying to run the UPDATE query.there is no
underlying..

ERROR MSG :An unhandled exception of type
'System.Data.OleDb.OleDbException' occurred in system.data.dll


Hi Lea,

I really can't tell what is wrong with your code. But I can tell you the
steps I would take to try to fix it:
-catch the exception that is being thrown that you are ignoring and see what
the message is
-when you are stepping through the debugger, get the generated SQL, and
attempt to run it in the databases native sql tool (Query Analyzer if using
SQLServer)

My guess is that you are generating an invalid sql statement, but check your
exception message before doing anything.

Good luck,
John MacIntyre
http://www.johnmacintyre.ca
Specializing in; Database, Web-Applications, and Windows Software
Jul 21 '05 #2
lea

i did write the error message in my 1st post, but i think u didnt notic
it. The Error MEssage is:"An unhandled exception of typ
'System.Data.OleDb.OleDbException' occurred in system.data.dll
". not much information about what is wrong with my coding. but INSER
INTO query has no problem.what's wrong :confused

--
le
-----------------------------------------------------------------------
lea's Profile: http://www.msusenet.com/member.php?userid=156
View this thread: http://www.msusenet.com/t-187051013

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Mike Leahy | last post: by
10 posts views Thread by Randy Harris | last post: by
7 posts views Thread by Mark Carlyle via AccessMonster.com | last post: by
31 posts views Thread by Lag | last post: by

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.