Results 1 to 8 of 8

Thread: Silly Search Question

  1. #1

    Thread Starter
    Addicted Member rinoaheartilly's Avatar
    Join Date
    Oct 2001
    Location
    Cymru
    Posts
    204

    Question 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?



  2. #2
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    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!

  3. #3

    Thread Starter
    Addicted Member rinoaheartilly's Avatar
    Join Date
    Oct 2001
    Location
    Cymru
    Posts
    204
    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



  4. #4
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    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

  5. #5

    Thread Starter
    Addicted Member rinoaheartilly's Avatar
    Join Date
    Oct 2001
    Location
    Cymru
    Posts
    204
    fanks



  6. #6

    Thread Starter
    Addicted Member rinoaheartilly's Avatar
    Join Date
    Oct 2001
    Location
    Cymru
    Posts
    204
    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?



  7. #7
    Swatty
    Guest
    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

  8. #8

    Thread Starter
    Addicted Member rinoaheartilly's Avatar
    Join Date
    Oct 2001
    Location
    Cymru
    Posts
    204
    Thanks!!! I just got a little confused. You#re brilliant, 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
  •  



Click Here to Expand Forum to Full Width