Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   SQLDataSource FilterExpression question (http://www.velocityreviews.com/forums/t677107-sqldatasource-filterexpression-question.html)

fniles 03-25-2009 02:28 AM

SQLDataSource FilterExpression question
 
I am using VS 2005.
In my ASP.NET page I have a combo box that lists the columns I can search
in, a Search text box (where you can input your search word) and a Search
button.
The result of the search appears in a gridview.
I have bound the gridview to a SQLDataSource.
When the Search button is hit, I set the filterExpression for the
SQLDataSource to something like so:
filterExpression = string.Format("[{0}] LIKE '%{1}%'",
cboSearch.SelectedValue, txtSearch.Text)
SqlDataSource1.FilterExpression = filterExpression

If I select "Module" from the combo box cboSearch, I would like to filter
the SQLdatasource with something like
where MODULE1 like '%' & {txtSearch.Text} '%' or MODULE2 like '%' &
{txtSearch.Text} '%'
How can I set the filterExpression to do the above ?

Thank you.




All times are GMT. The time now is 12:25 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.