Results 1 to 3 of 3

Thread: SQL

  1. #1

    Thread Starter
    Addicted Member CoMMiE's Avatar
    Join Date
    Jul 2000
    Location
    Malaysia, Kuala Lumpur
    Posts
    179

    Question

    Hi all
    I have a question about SQL and i hope you guys out there can help me out

    1. How do i write a SQL statement in VB to select a particular row of data according to its date?

    ex if i want to select customer name john who has made an order in 1/2/99


    Thanks for the help


  2. #2
    Lively Member
    Join Date
    Nov 1999
    Posts
    88
    i'm going to assume that you have two textboxes on a form which will carry the criteria you need to query. the first textbox we will name txtName and the second will be txtDate.

    dim sqlQuery as string
    dim strName as String
    dim strDate as String

    strName = txtName.Text
    strDate = txtDate.Text

    sqlQuery = "SELECT * FROM table WHERE name = ' " & strName & " ' AND date = #" & strDate & "#"

    [note: do not put spaces in between the single quotes ( ' ) and the double quotes ( " )]

    if you plugged-in "john" and "01/02/2000" into the textboxes, you would get the following statement:

    SELECT * FROM table WHERE name = 'john' and date = #01/02/2000#

    hope this was of help.

  3. #3

    Thread Starter
    Addicted Member CoMMiE's Avatar
    Join Date
    Jul 2000
    Location
    Malaysia, Kuala Lumpur
    Posts
    179

    Thumbs up

    Thanks a lot dwhawley

    Thats the solution i am looking for

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