in a database i have some conditions, after retrieving rows from the database i want to go through the conditions find out which rows match the condition then style them, at the moment i do it by taking the row putting it into a datatable creating a dataview
applying the filter and check if rows==0, not very efficient.
can anyone suggest a better way? i've looked at the way .net does it but the classes are marked internal so i cannot use them
here is the database structure
Condition table
ID (1)
Expression (FirstName LIKE 'x%')
RowCssClass (test)
then in code
DataTable dt = Getsomedata();
for (int i=0; i<dt.Rows.Count; i++)
{
// put row into datatable and get dataview then filter
if (conditionmetd) { style the row }
}
any ideas?
thanks
-
-
Well, you don't show how you "get some data" but I am going to assume you are using dynamic sql with the expressions that are stored in the db.
If you are, select the expression itself as one of the columns for the data table, of course you would hide this column client side...then you can just loop and compare on the column's value to determine if it matches said condition...of course you want to properly escape the expression when selecting it as a string...
For example, "SELECT * , 'first_name LIKE ''someName%'' AS filterCondition FROM tablename"
then you can use the "filterCondition" column of the resulting table... -
i cannot change the query, any other ideas?
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.