2
Contributors
13
Replies
14
Views
6 Years
Discussion Span
Last Post by Saikalyankumar
0

For, this type of things. Better to take the values in the textbox and rebind the data in the database, but with the where condition in the sql query. And in the resultant Dataset only the required search results will be there, later bind the resultant dataset to the datagrid.

0

i use this query to search data from column 1..

LIKE ? + '%'

can i use this 2 both column ?

0

you can't use the LIKE keyword for filtering the values in the Database for both columns, because they both have different values of different datatypes. Use only where keyword for the filter.

0

I you use LIKE keyword for two different columns in a table of the database, then conflicts occur at that time, you will get wrong result.

0

ok...how to search data in datagrid by date only??

what query i need ??

Edited by arezz09: n/a

0

Ok, if you want to do that follow the code below.

Dim dView As New DataView
                dView = Session.Item("ReportDS")
                Session.Item("ReportDS") = ""
                dView.RowFilter = strCondition.ToString
                Session.Item("ReportDS") = dView
                CMSgrid.DataSource = dView

Edited by Saikalyankumar: Modified the Coding

0

how to declare this...
strCondition
Session
CMSgrid

("ReportDS") are this column..

0

strCondition is an string in which you have to give the Condition what you want to filter i.e., for ex

strCondition="Empno =" & empno & "and" & "Empname ='" & empname & "'"

, CMSgrid here means the gridview name ok, give the gridview id which you have given at that place, and the

Session.Item("ReportDS")

is nothing but the session variable. When you bind the values at first time from the database, pass the dataset you have retrieved into this session variable for sorting the records.

Edited by Saikalyankumar: Edited the Description.

0

Hello, "ReportDS" is not column name its session name ok. The combined

Session.Item("ReportDS")

is called as Session variable, you can use any name as giving for a session variable. And dont seperate the "ReportDS" and Session ok.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.