Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › VB Access SQL Update Syntax Error
New Posts  All Forums:Forum Nav:

VB Access SQL Update Syntax Error

post #1 of 2
Thread Starter 
Derp I`ve been coding for 10 hours and my brain hurts
The code below gives me Syntax error in Update Statement

ISBN Year of purchase Book Number are integers rest are strings

Do I have to cast from the string of the textbox to an integer?
Quote:
UpdateCommand.CommandText = "Update TblBook Set [Shelf_Number] =" + uShelfNoTxt.Text &
", ISBN =" + uIsbnTxt.Text &
", Author =" + uAuthorTxt.Text &
", Title =" + uTitleTxt.Text &
", Syllabus =" + uSyllabusTxt.Text &
", Genre =" + uGenreTxt.Text &
", Description =" + uDescriptionTxt.Text &
", YearOfPurchase =" + uYearOfPurchaseTxt.Text &
", WHERE(Book_Number =" + uBookNoTxt.Text + ")"
AzuraChan
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 1055T Asus M4A88TD-V Evo/Usb3 EVGA GTX460 1GB SC + 9800GT Phsyx 2x2GB Corsair 1333MHZ 
Hard DriveOSMonitorPower
6.8TB Total w7 + ubuntu 19" something Seasonic S12II 520W 
Case
modded antec 902 
  hide details  
Reply
AzuraChan
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 1055T Asus M4A88TD-V Evo/Usb3 EVGA GTX460 1GB SC + 9800GT Phsyx 2x2GB Corsair 1333MHZ 
Hard DriveOSMonitorPower
6.8TB Total w7 + ubuntu 19" something Seasonic S12II 520W 
Case
modded antec 902 
  hide details  
Reply
post #2 of 2
Do you have the error message? If ISBN Year of purchase Book Number are integers rest are strings, try this to see what happens....


UpdateCommand.CommandText = "Update TblBook Set [Shelf_Number] ='" & uShelfNoTxt.Text &
"', ISBN ='" + uIsbnTxt.Text &
"', Author ='" + uAuthorTxt.Text &
"', Title ="' + uTitleTxt.Text &
"', Syllabus ='" + uSyllabusTxt.Text &
"', Genre =" + uGenreTxt.Text &
"', Description ='" + uDescriptionTxt.Text &
"', YearOfPurchase ="' + uYearOfPurchaseTxt.Text &
"', WHERE Book_Number =" & uBookNoTxt.Text & " ;"
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › VB Access SQL Update Syntax Error