Posted on 2005-04-22
I have an SQL query in an OleDBCommand in VB.NET 2003 that retrieves data from an Access database. It looks like this:
"SELECT * FROM Files WHERE File_Num = 'R00001'"
This works perfectly. Now, if I change it to
"SELECT * FROM Files WHERE File_Num = %"
It returns nothing. What I'm trying to do is to return all rows where File_Num is equal to anything. I know that I can just say:
"SELECT * FROM Files"
but the problem is that I actually have the File_Num as a parameter in a OleDbSelectCommand because most of the time I will want to filter by a particular File_Num, but sometimes I won;ty want to. I will want to display all rows with any File_Num. What do I pass the parameter in such cases? Looks like % doesn't work.