-
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
-
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.
-
Thanks a lot dwhawley
Thats the solution i am looking for