|
-
Jun 19th, 2001, 03:02 PM
#1
simple SQL question
I need to pass info held in Long variables and a TextBox control array to a database in a SQL statement...can anyone give me some sample code on how to do it? (I already have DB connection established and stuff...just need the SQL)
Thanks!
-jason
-
Jun 19th, 2001, 03:24 PM
#2
PowerPoster
Just use normal string interpolation...
VB Code:
SELECT * FROM table WHERE table.somefield = " & myVariable or textbox.text & " ORDER BY suchandsuch;"
-
Jun 19th, 2001, 04:00 PM
#3
I'll try it out.
Many thanks
-
Jun 20th, 2001, 10:36 AM
#4
hmm...I tried this:
Code:
"INSERT INTO Members VALUES(" & NewID & ", " & Text1(0).Text & ", " & Text1(1).Text & ", " & Text1(2).Text & ", " & Text1(6).Text & ", " & SSN & ", " & Text1(7).Text & ", " & Text1(5).Text & ", " & Typevar & ", " & FFID & ")"
and I got this error:
"The name 'hj' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted."
"hj" is what I typed into the first of the textboxes as a test.
Any help is appreciated. thanks.
-
Jun 20th, 2001, 11:08 AM
#5
PowerPoster
hmm...try putting a msgbox before the sql statement to see what it is actually doing, like this
VB Code:
Msgbox "INSERT INTO Members VALUES(" & NewID & ", " & Text1(0).Text & ", " & Text1(1).Text & ", " & Text1(2).Text & ", " & Text1(6).Text & ", " & SSN & ", " & Text1(7).Text & ", " & Text1(5).Text & ", " & Typevar & ", " & FFID & ")"
. It may be something really obvious that usually makes itself known using msgboxes.
-
Jun 20th, 2001, 04:06 PM
#6
Worked! Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|