|
Thread: SQL
-
Jul 27th, 2000, 04:18 AM
#1
Thread Starter
Addicted Member
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
-
Jul 27th, 2000, 08:47 AM
#2
Lively Member
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.
-
Jul 27th, 2000, 09:18 AM
#3
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|