|
-
Aug 1st, 2000, 02:42 PM
#1
Thread Starter
Junior Member
I am writing a customer support application in VB 6.0 with MS SQL 7.0 backend.
I need to create a end user front end form to query the database by either typing in the fields directly as search parameters or using a query grid to build the query using comparison symbols.
ex . query grid contains a text box where user can enter field in database to search as in:
LName = "Smith" AND FName = "Susan"
or
DateOpened >= "01/01/2000"
I know this must require the use of dynamic SQL.
Thanks
-
Aug 2nd, 2000, 07:53 AM
#2
Lively Member
try the following SELECT statement
assume that your table is tblData with three fields of interest, FName, LName, Date and that you have three textboxes: txtFName, txtLName, txtDate
Dim strFName as String
Dim strLName as String
Dim strDate as String
strFName = txtFName.Text
strLName = txtLName.Text
strDate = txtDate.Text
"SELECT * FROM tblData WHERE FName = ' " & strFName & " ' AND LName = ' " & strLName & " ' AND Date = ' " & strDate & " ' "
[note that there are no spaces between double quotes ( " ) and single quotes ( ' ).]
i hope this helps
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
|