Hi, I am trying to remove a complete row from a GridView if it satisfied a condition.
Here I have got
a Description Column from Product table in database
with which a GridView is populated. I set the sqlcommand in my vb app to only
select the Description which does not contain the String s
String s has two keywords "Tomatoes" and "Apple"
So the Sql Query should retrieve the
Description that does not have "Tomatoes" and "Apple"
and therefore the Gridview should be updated by removing the rows which satisfy the condition.
I am facing a difficulty in removing the
Description row in GridView
which has "Tomatoes" and "Apple". I tried populating another GridView with the results, but it does not appear in the web page despite the fact that everything is correct because I have seen the values where I specified some Breakpoints. Any suggestions or thoughts?
Here is my code:
Dim cmd1 = New SqlCommand(" SELECT DISTINCT [Description] FROM [Product] WHERE ([Description] LIKE '%' + @Description + '%')", conn)
For i As Integer = 0 To GridView1.Rows.Count - 1
DA.SelectCommand = cmd1