.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 16th, 2004, 04:50 AM
Louisa Louisa is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Kent, England
Posts: 60 Louisa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 38 m 56 sec
Reputation Power: 5
Syntax error in update

I have a simple update where I am adding new row into a database, but it errors saying syntax error in the insert into. I have almost identical code and it works fine, what am I doing wrong, it is driving me insane.

Louisa

Code:

StrSave = "Select passwords.id, passwords.name, passwords.login, passwords.password, passwords.addedby from Passwords"
SaveAdapter = New OleDb.OleDbDataAdapter(StrSave, myConnection)

SaveAdapter.Fill(SaveData, "Passwords")

StrMax = "Select max(ID) as MaxID from passwords"

MaxAdapter = New OleDb.OleDbDataAdapter(StrMax, myConnection)

MaxAdapter.Fill(MaxData, "Passwords")

Dim TblSave As DataTable
TblSave = SaveData.Tables("Passwords")

Dim SaveRow As DataRow
SaveRow = TblSave.NewRow()

Dim MaxID As Integer
MaxId = MaxData.Tables(0).Rows(0).Item("MaxId") + 1
SaveRow("id") = MaxID
SaveRow("Name") = TxtName.Text
SaveRow("Login") = TxtLogin.Text
SaveRow("Password") = TxtPassword.Text
SaveRow("Addedby") = "Louisa"

TblSave.Rows.Add(SaveRow)
Dim objCommandBuilder As New OleDb.OleDbCommandBuilder(SaveAdapter)
SaveAdapter.Update(SaveData, "passwords")

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Syntax error in update


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT