Click here to Skip to main content
15,890,609 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How to create a loop in visual basic which reads through a sensor through parallel port Pin
Dave Kreskowiak22-Mar-10 15:20
mveDave Kreskowiak22-Mar-10 15:20 
GeneralNot the LHC Pin
Luc Pattyn22-Mar-10 15:46
sitebuilderLuc Pattyn22-Mar-10 15:46 
GeneralRe: Not the LHC Pin
Dave Kreskowiak23-Mar-10 1:09
mveDave Kreskowiak23-Mar-10 1:09 
GeneralRe: Not the LHC Pin
Luc Pattyn23-Mar-10 4:41
sitebuilderLuc Pattyn23-Mar-10 4:41 
GeneralRe: Not the LHC Pin
Dave Kreskowiak23-Mar-10 6:09
mveDave Kreskowiak23-Mar-10 6:09 
GeneralRe: Not the LHC Pin
Luc Pattyn23-Mar-10 8:14
sitebuilderLuc Pattyn23-Mar-10 8:14 
QuestionInvalid column name error Pin
fresh120722-Mar-10 10:07
fresh120722-Mar-10 10:07 
AnswerRe: Invalid column name error PinPopular
Dave Kreskowiak22-Mar-10 10:36
mveDave Kreskowiak22-Mar-10 10:36 
First, we, again, emplore you to drop the string concatentation technique and USE PARAMETERIZED QUERIES instead?

Why? Because you never would have run into this problem if you did.

The SqlParameter class would have properly formatted your data for each field. You're not enclosing the strings you are sending to the VarChar fields in your database in quotation marks, as required by SQL.

Your SQL has to look like this:
INSERT INTO myTable (someTextField) VALUES ("myStringData")


Your code is building the SQL statement like this, which doesn't work:
INSERT INTO myTable (someTextField) VALUES (myStringData)

Notice, the quote marks are missing. This is the problem you are running into.

Since you are also making the huge mistake of using text directly from TextBoxes and not validating any of it, you are opening yourself up to SQL Injection attacks as well as letting users put bad/unnormalized data into every field of your table.

A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008
But no longer in 2009...




AnswerRe: Invalid column name error Pin
David Skelly23-Mar-10 2:35
David Skelly23-Mar-10 2:35 
QuestionrichTextBox and lines with word wrap Pin
norrisMiou22-Mar-10 8:13
norrisMiou22-Mar-10 8:13 
AnswerRe: richTextBox and lines with word wrap Pin
Gregory Gadow22-Mar-10 9:28
Gregory Gadow22-Mar-10 9:28 
AnswerRe: richTextBox and lines with word wrap Pin
William Winner23-Mar-10 13:04
William Winner23-Mar-10 13:04 
GeneralRe: richTextBox and lines with word wrap Pin
norrisMiou25-Mar-10 3:43
norrisMiou25-Mar-10 3:43 
GeneralRe: richTextBox and lines with word wrap Pin
William Winner25-Mar-10 8:15
William Winner25-Mar-10 8:15 
QuestionVisual Basic 6.5 context sensitive/auto-complete wackyness Pin
john john mackey22-Mar-10 7:10
john john mackey22-Mar-10 7:10 
AnswerRe: Visual Basic 6.5 context sensitive/auto-complete wackyness Pin
J$22-Mar-10 9:32
J$22-Mar-10 9:32 
GeneralRe: Visual Basic 6.5 context sensitive/auto-complete wackyness Pin
john john mackey22-Mar-10 10:43
john john mackey22-Mar-10 10:43 
GeneralRe: Visual Basic 6.5 context sensitive/auto-complete wackyness Pin
J$22-Mar-10 11:39
J$22-Mar-10 11:39 
GeneralRe: Visual Basic 6.5 context sensitive/auto-complete wackyness Pin
john john mackey22-Mar-10 13:28
john john mackey22-Mar-10 13:28 
GeneralRe: Visual Basic 6.5 context sensitive/auto-complete wackyness Pin
J$22-Mar-10 13:50
J$22-Mar-10 13:50 
GeneralRe: Visual Basic 6.5 context sensitive/auto-complete wackyness Pin
Dave Kreskowiak22-Mar-10 15:16
mveDave Kreskowiak22-Mar-10 15:16 
GeneralRe: Visual Basic 6.5 context sensitive/auto-complete wackyness Pin
john john mackey23-Mar-10 10:07
john john mackey23-Mar-10 10:07 
GeneralRe: Visual Basic 6.5 context sensitive/auto-complete wackyness Pin
Luc Pattyn22-Mar-10 16:14
sitebuilderLuc Pattyn22-Mar-10 16:14 
GeneralRe: Visual Basic 6.5 context sensitive/auto-complete wackyness Pin
john john mackey23-Mar-10 5:53
john john mackey23-Mar-10 5:53 
GeneralRe: Visual Basic 6.5 context sensitive/auto-complete wackyness Pin
Luc Pattyn23-Mar-10 5:59
sitebuilderLuc Pattyn23-Mar-10 5: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.