User-1199946673 posted
But somehow my SQL command, as well as the query builder is not really helping me in this process
That's because the VWD/Visual Studio query builder doen't fully support Access. Only very simple basic statements are supported.
Also, bevause you can select on or more colums in the lixtbox to do the select, even when using SQL Server, you'll need to do some coding to create the SelectCommand, because you cannot parameterize columns. When using as Access- Or SQL-DataSource names
DsBooks it shoudl be something like:
DsBooks.SelectCommand = "SELECT * FROM BOOKS WHERE Category = @Category"
For Each Item As ListItem In listbox1.Items
If Item.Selected Then
DsBooks.SelectCommand += String.Format(" AND {0} Like @Search + '%'", Item.Text)
End If
Next
and you can use Control parameters to bind the parameters:
<SelectParameters>
<asp:ControlParameter Name="Category" ControlID="CategoryDropDownList" PropertyName="SelectedValue" />
<asp:ControlParameter Name="Search" ControlID="SearchTextBox" PropertyName="Text" />
</SelectParameters>
And if you want to show all records in the gridview when the textbox is empty, don't forget to set the CancelSelectOnNullParameter of the DataSource to false
More info
http://www.mikesdotnetting.com/Article/68/An-ASP.NET-Search-Engine-with-MS-Access-for-optional-search-criteria
But I see you're using an ObjectDataSource? Then it all deplands how you coded your object....