Results 1 to 2 of 2

Thread: Database Query - QBE?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    16

    Exclamation

    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

  2. #2
    Lively Member
    Join Date
    Nov 1999
    Posts
    88
    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
  •  



Click Here to Expand Forum to Full Width