Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 18th, 2008, 10:40 AM   #1
TheFuture
Newbie
 
Join Date: Apr 2008
Posts: 1
Rep Power: 0 TheFuture is on a distinguished road
Problems updating access database

I'm keep getting this error message when I try to update to my database. It's an access database and I thought I everything right because I can view all the records but when I try to update it I get this message.

Syntax error (missing operator) in query expression '((ID = ?) AND ((? = 1 AND First Name IS NULL) OR (First Name = ?)) AND ((? = 1 AND Last Name IS NULL) OR (Last Name = ?)) AND ((? = 1 AND Address IS NULL) OR (Address = ?)) AND ((? = 1 AND City IS NULL) OR (City = ?)) AND ((? = 1 AND State IS NULL) OR (St'.

Here is where I make the connection.
rivate Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
vb Syntax (Toggle Plain Text)
  1. con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\AddressBook1.mdb"
  2. con.Open()
  3.  
  4. sql = "SELECT * FROM tblContacts"
  5. da = New OleDb.OleDbDataAdapter(sql, con)
  6.  
  7. da.Fill(ds, "AddressBook")
  8.  
  9. con.Close()
  10.  
  11. MaxRows = ds.Tables("AddressBook").Rows.Count
  12. inc = -1
  13.  
  14. End Sub
  15.  
  16. Here is the code for my update button.
  17.  
  18.  
  19. Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
  20. If inc <> -1 Then
  21. Dim cb As New OleDb.OleDbCommandBuilder(da)
  22. ds.Tables("AddressBook").Rows(inc).Item(1) = firstTextBox.Text
  23. ds.Tables("AddressBook").Rows(inc).Item(2) = lastTextBox.Text
  24. ds.Tables("AddressBook").Rows(inc).Item(3) = addressTextBox.Text
  25. ds.Tables("AddressBook").Rows(inc).Item(4) = cityTextBox.Text
  26. ds.Tables("AddressBook").Rows(inc).Item(5) = stateTextBox.Text
  27. ds.Tables("AddressBook").Rows(inc).Item(6) = zipTextBox.Text
  28. ds.Tables("AddressBook").Rows(inc).Item(7) = phoneTextBox.Text
  29. ds.Tables("AddressBook").Rows(inc).Item(8) = cellTextBox.Text
  30. ds.Tables("AddressBook").Rows(inc).Item(9) = emailTextBox.Text
  31. ds.Tables("AddressBook").Rows(inc).Item(10) = birthdayTextBox.Text
  32.  
  33. da.Update(ds, "AddressBook")
  34.  
  35. MsgBox("Data updated")
  36. Else
  37. MsgBox("No Records Yet")
  38. End If
  39.  
  40. End Sub
SOMEONE HELP PLEASE! I've been trying to figure this out for two days and this assignment it due tonight. thanks

Last edited by Ancient Dragon; Apr 18th, 2008 at 5:04 PM. Reason: add code tags
TheFuture is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MYOB Database Access Driver MiKuS PHP 1 Oct 31st, 2007 11:05 PM
searching an access database? designXperts.net Visual Basic .NET 12 Nov 27th, 2005 5:03 PM
How to connect with VB to an Access database on another computer iown714 Visual Basic 5 Aug 4th, 2005 10:23 AM
java and MS Access database borceivanovski Java 0 Apr 26th, 2005 4:28 PM
problem with JDBC for talking to Microsoft Access database using a Java Applet captainK Java 4 Mar 20th, 2005 11:01 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:27 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC