-
Silly Search Question
I've designed a simple program to access a database, using the ADO tool. But how would I search through it? My teacher mentioned something about SQL on friday, but now he's got the flu (probably off me, he he he ;)) so I'm stuck. My text book doesn't say anything about it either. I know there's probably a few ways to do it, so, any suggestions?
-
he's right, with sql!
something like
"SELECT * FROM yourTable WHERE someField=" & someValue
this will select all record(and all the field) from yourTable
where someField equals to somevalue!
search on sql, you will find a lot!
-
thanks :) I've only just started doing VB properly, we only looked at the different tools, eg how to draw text boxes, in sept.
I keep getting a compile error? It's expecting an end of statement, lol. How would I search from whats been entered in a text box?
PS Does anyone know where i can get vb6 cheap? I only have the copy my friend lent me, and it doens't have the help files, or samples with it, so it's making life difficult for me :(
-
show me some code
if a number
"SELECT * FROM yourTable WHERE someField=" & txtValue.Text
if a string
"SELECT * FROM yourTable WHERE someField='" & txtValue.Text &"'"
good luck
-
-
hokay, i'm still having problems. This is what i've come up with so far.
PHP Code:
"SELECT * from birds1 where class no=txtvalue.text
What am I missing?
-
You have to close the quotes.
Did you read the previous answer.
if you're searching on a string the value must be entered between single quotes ,else no single quotes.
your string :
"SELECT * from birds1 where class no=txtvalue.text
if class no is a field name it should be placed between brakets.
so it would be for a text value in class no
"SELECT * from birds1 where [class no] = '" & txtvalue.text & "'"
and for a number in class no
"SELECT * from birds1 where class no= " & txtvalue.text
I hope this helps
-
Thanks!!! I just got a little confused. You#re brilliant, thanks :)
http://www.vbforums.com/