Luca Posted December 19, 2003 Posted December 19, 2003 I'm using the OLEDB updatecommand. I want to update one item in table in my database. Here is a part of my code: Dim myUpdateQuery As String = "UPDATE Customer SET CustomerID = '111' " customerdap = New OleDb.OleDbDataAdapter(selstr2, cn) customerdap.Fill(myCustomertab) customerdap.UpdateCommand = New OleDb.OleDbCommand myUpdateQuery, cn) customerdap.Update(myCustomertab) ----------------------------------------- Somehow it doesn't work and I don't know why. Maybe I forgot something important. Thank's for any help. Quote
kahlua001 Posted December 20, 2003 Posted December 20, 2003 What is the datatype of CustomerID ? Is it a int or string? Trying taking out the single quotes. Quote
Administrators PlausiblyDamp Posted December 21, 2003 Administrators Posted December 21, 2003 When you say it doesn't work - what error does it give? Is there more than one customer in the table and what is it's primary key as it looks like you are trying to set all the customer id values to 111. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Luca Posted December 21, 2003 Author Posted December 21, 2003 The Datatype of the CustomerID is integer. There is only one row in the dataset. Because: selstr2 = "Select * from Customerwhere CustomerID = " & textbox1.text dap = New OleDb.OleDbDataAdapter(selstr2, cn) Then there is only one row in my DataTable. Actually there was no error message, the value just didn't get into the my Database in the Customertable. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.