Jul 7, 2010
I'm using Visual Studio 2005, and I have a datagrid connected to a table from an Access database.
View 6 Replies
I added 4 textboxes so the user can type search filters to search within the table and a "search" button.
Then, I created a query using the "add query" tool on the datagrid. I wrote it like: select field1, field2, field3, field4, field5, field6 from table where field1=? and field2 like "%"+?+"%" and field3 like "%"+?+"%"
and field4 like "%"+?+"%"
Both field5 and field6 aren't search criterias, so I didn't add them to the query. Once the query was created, I replaced the parameters inside the procedure with my textbox1.text, textbox2.text, textbox3.text, textbox4.text and then cut and pasted the whole thing inside my SEARCH button click event, so the query is executed when the user clicks on the button.
Now the problem is: when I search using the first field it goes ok, but when I try to search by any of the other fields it returns zero results, even though I double-checked I had written the words correctly. I don't know why it does this. I already tried deleting the datagrid and creating it again.[code]...