Hello. I am using the dataset designer to create my SQL queries for a VB project, but cannot figure out how to create a query that will filter my records properly. I am using an Access database.
In a nutshell, I cannot get my SQL query to distinguish between 0,1 and 10.
Here is my query:
SELECT ID, Word, Definition, Source, Unit, Chars, Cat, WordType, Context, Literal, Ant, Syn, ConfusedWith, OnList, Audio0, Audio1, Audio2, Audio3
FROM Vocab
WHERE (Instr( ,OnList)>0)
is a string that reflects what the user selected. It could be any numbers, 1 through 10, in a string format. ie. "7,8,9 10" or "0,1,9,10". Here is my TableAdapter.FillBy method I use to execute the SQL query:
VocabTableAdapter.FillByCat(frmMain.ChineseDataSet.Vocab,
MyKnow)The "OnList" field from my Access database contains a number, 0 through 10.
The problem is that if I want to display only records where =10, it will display records with 0's and 1's as well. So, the returned records would include all records where Onlist = 0, 1, and 10. But, I only wanted to see records where Onlist = 10.
How can I get it to distinguish between 0, 1 and 10. Thanks for any help. I have tried lots of things with no success.
Thanks,
Jack

SQL parameter query using INSTR
timpg
SELECT ID, Word, Definition, Source, Unit, Chars, Cat, WordType, Context, Literal, Ant, Syn, ConfusedWith, OnList, Audio0, Audio1, Audio2, Audio3
FROM Vocab
WHERE OnList IN ( )
But I don't know how to phrase my TableAdapter code for multiple values:
frmMain.VocabTableAdapter.FillByCat(frmMain.ChineseDataSet.Vocab, 10) '===> THIS WORKS
frmMain.VocabTableAdapter.FillByCat(frmMain.ChineseDataSet.Vocab, "0,2,10") '===> THIS DOES NOT WORK