Click here to Skip to main content
15,893,266 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionIncorrect syntax Pin
fresh120721-Mar-10 10:54
fresh120721-Mar-10 10:54 
AnswerRe: Incorrect syntax Pin
Luc Pattyn21-Mar-10 11:22
sitebuilderLuc Pattyn21-Mar-10 11:22 
AnswerRe: Incorrect syntax Pin
DaveAuld21-Mar-10 11:37
professionalDaveAuld21-Mar-10 11:37 
GeneralRe: Incorrect syntax Pin
fresh120721-Mar-10 18:06
fresh120721-Mar-10 18:06 
GeneralRe: Incorrect syntax Pin
εїзεїзεїз21-Mar-10 19:38
εїзεїзεїз21-Mar-10 19:38 
GeneralRe: Incorrect syntax Pin
Steven J Jowett22-Mar-10 3:03
Steven J Jowett22-Mar-10 3:03 
GeneralRe: Incorrect syntax Pin
fresh120722-Mar-10 7:43
fresh120722-Mar-10 7:43 
GeneralRe: Incorrect syntax Pin
David Skelly22-Mar-10 23:15
David Skelly22-Mar-10 23:15 
Your insert statement is not correct. For example:

VALUES(" & TextBox1.Text & "," & TextBox2.Text & "...


If the value of TextBox1.Text is A and TextBox2.Text is B, this will give:

VALUES(A, B...


So, the SQL query goes looking for a column called A and a column called B, which don't exist so the query fails.

What you want is:

VALUES('A', 'B'...


Note the apostrophes.

As other people have pointed out, string concatenation is simple and easy but it is better to use parameterised queries for a number of reasons, one of which is that you don't have to worry about where to put the apostrophes.
QuestionScreen sizes Pin
offroaderdan21-Mar-10 2:58
offroaderdan21-Mar-10 2:58 
AnswerRe: Screen sizes Pin
DaveAuld21-Mar-10 3:27
professionalDaveAuld21-Mar-10 3:27 
GeneralRe: Screen sizes Pin
offroaderdan21-Mar-10 7:56
offroaderdan21-Mar-10 7:56 
GeneralRe: Screen sizes Pin
Dalek Dave21-Mar-10 8:05
professionalDalek Dave21-Mar-10 8:05 
GeneralRe: Screen sizes Pin
Dalek Dave21-Mar-10 13:50
professionalDalek Dave21-Mar-10 13:50 
GeneralRe: Screen sizes Pin
David Skelly21-Mar-10 23:05
David Skelly21-Mar-10 23:05 
GeneralRe: Screen sizes Pin
Dalek Dave21-Mar-10 23:10
professionalDalek Dave21-Mar-10 23:10 
GeneralRe: Screen sizes Pin
DaveAuld21-Mar-10 9:20
professionalDaveAuld21-Mar-10 9:20 
GeneralRe: Screen sizes Pin
offroaderdan21-Mar-10 10:01
offroaderdan21-Mar-10 10:01 
GeneralRe: Screen sizes Pin
DaveAuld21-Mar-10 10:24
professionalDaveAuld21-Mar-10 10:24 
GeneralRe: Screen sizes Pin
offroaderdan21-Mar-10 10:34
offroaderdan21-Mar-10 10:34 
GeneralRe: Screen sizes Pin
Mycroft Holmes21-Mar-10 20:59
professionalMycroft Holmes21-Mar-10 20:59 
QuestionParallel Port Interfacing using Visual Basic Pin
Fahimul720-Mar-10 11:03
Fahimul720-Mar-10 11:03 
AnswerRe: Parallel Port Interfacing using Visual Basic Pin
Luc Pattyn20-Mar-10 11:27
sitebuilderLuc Pattyn20-Mar-10 11:27 
GeneralRe: Parallel Port Interfacing using Visual Basic Pin
Fahimul720-Mar-10 11:53
Fahimul720-Mar-10 11:53 
GeneralRe: Parallel Port Interfacing using Visual Basic Pin
Luc Pattyn20-Mar-10 12:21
sitebuilderLuc Pattyn20-Mar-10 12:21 
AnswerRe: Parallel Port Interfacing using Visual Basic Pin
LloydA11120-Mar-10 11:59
LloydA11120-Mar-10 11:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.