dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Compare data in vb

  1. #1
    Join Date
    Jan 2007
    Posts
    2

    Question Compare data in vb

    Hey guys..m just tryin to compare data in visual basic with data in access but i dont know how to proceed with it. can anyone help me out...just to explain further what i m doin is:

    i m creating a flight enquiry system in which a person email me..that email is then copied into the text file. that text file is opened in visual basic and all the words are broken down into seperate line for example, my name is bob and i wanna book a flight from heathrow to america. this is the email a person sends us. when this is opened in vb it appears as
    my
    name
    is
    bob
    and
    i
    wanna
    book
    a
    flight
    from
    heathrow
    to
    america.

    the words i want to match with the database in access are Bob, heathrow and america. the data is already there in access but i dunno how to do it...can neone help me out plz.
    thankyou

  2. #2
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    The first place to start is to open the database in access, create a query that searchs for those specific entries (Bob, heathrow, america). Once you have a query that returns the records that you would expect based on those items, then open the query in SQL mode. Copy the SQL and move it to a VB String. Remember that any quote marks in your SQL statement will have to be doubled when you assign it to the string variable. Example:
    SELECT * FROM tblReservation WHERE [Airport] = "heathrow" And [Destination] = "america" And [FirstName] ="Bob";
    ...becomes
    Dim strSQL As String
    strSQL = "SELECT * FROM tblReservation WHERE [Airport] = ""heathrow"" And [Destination] = ""america"" And [FirstName] =""Bob"";"

    Now change the SQL to replace the items you entered from access (Bob, heathrow, america) into variables from your program Like this:
    strSQL = "SELECT * FROM tblReservation WHERE [Airport] = """ & strAriport & """ And [Destination] = """ & strDestination & """ And [FirstName] =""" & strFirstName & """;"

    Now when you read your file you can set the variables to the values you just read in and use the assignment statement above to create the needed SQL statement. Now all you have to do is open a connection to your database and open a recordset object using the SQL statement that you created above.

  3. #3
    Join Date
    Jan 2007
    Posts
    2
    bt the ting is everythin is done automatically. i kinda need a loop wich keeps findin the match until it finds one, n if it doesnt then it tells no match found, got it?

Similar Threads

  1. Why I can't save data in data base?
    By Kurt in forum Java
    Replies: 7
    Last Post: 10-08-2006, 08:59 AM
  2. retrieving data fastly using vb and oracle
    By Om Prakash in forum Database
    Replies: 2
    Last Post: 07-15-2002, 10:19 AM
  3. VB and storing, retrieving pixel data
    By Ken MacLean in forum VB Classic
    Replies: 2
    Last Post: 09-16-2001, 01:51 PM
  4. Replies: 84
    Last Post: 01-29-2001, 02:12 PM
  5. Replies: 3
    Last Post: 07-14-2000, 11:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center