|
-
Mar 1st, 2013, 10:35 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Fox Pro Database SQL when using variables
i have a vb.net 2010 app i trying to connect a dbf file. i think its a fox pro database. i can connect to it fine and get all data from a column just fine. the problem is when i use the WHERE clause i dont know how to surround the variable since i have never used this type of database before now. this is what i have
Code:
Dim oCmdSelect As New OleDbCommand("SELECT LASTNAME, FIRSTNAME FROM UPDATED WHERE LASTNAME = lstItems1.Items(x).ToString, FIRSTNAME = lstItems2.Items(x).ToString", oAccessConn)
so the lstItems1.Items(x).ToString is a listbox entry. i basically have a list box with about 800 names. i what to open the database to see if they exist in it with i guess a while loop, not sure about that yet. but i have searched everywhere and i can find out how to surround the lstItems1.Items(x).ToString
Last edited by seanwpb; Mar 1st, 2013 at 10:36 AM.
Reason: typo
-
Mar 1st, 2013, 10:45 AM
#2
Re: Fox Pro Database SQL when using variables
Chr(39) & lstItems1.Items(x).ToString & Chr(39)
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
Mar 1st, 2013, 11:20 AM
#3
Thread Starter
Hyperactive Member
Re: Fox Pro Database SQL when using variables
JG,
thanks for the quick reply. this is what i have and the error follows
"SELECT LASTNAME, FIRSTNAME FROM UPDATED WHERE LASTNAME = Chr(39) & lstItems1.Items(x).ToString & Chr(39)"
error: command contains unrecognized phrase/keyword. any ideas?
-
Mar 1st, 2013, 01:31 PM
#4
Re: Fox Pro Database SQL when using variables
Code:
"SELECT LASTNAME, FIRSTNAME FROM UPDATED WHERE LASTNAME = " & Chr(39) & lstItems1.Items(x).ToString & Chr(39)
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
Mar 3rd, 2013, 06:18 PM
#5
Thread Starter
Hyperactive Member
Re: Fox Pro Database SQL when using variables
that was it. thank you so much
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
|