Search specific Column of a database
-
I want to add a search box on my Site that searches in the from specific column of a database.. Suppose the table consists of columns NAME OF BOOK,PUBLISHER,CATEGORY,FORMAT. it should be like this searchbox (User Input) dropdownlist(to search in specific column) 1)Name of book 2)Publisher 3)category resulting gridview control must contain the results with all the columns iam a beginner...
-
I want to add a search box on my Site that searches in the from specific column of a database.. Suppose the table consists of columns NAME OF BOOK,PUBLISHER,CATEGORY,FORMAT. it should be like this searchbox (User Input) dropdownlist(to search in specific column) 1)Name of book 2)Publisher 3)category resulting gridview control must contain the results with all the columns iam a beginner...
if you are using DataSet to fill the GridView thant call your DataSet in DataView class and your filter property to filter the data. if you are using ObjectDatasource then you can define filterexpression of object data source. I havn't used SqlDatasource you need to study ..
Naveed Kamboh
-
if you are using DataSet to fill the GridView thant call your DataSet in DataView class and your filter property to filter the data. if you are using ObjectDatasource then you can define filterexpression of object data source. I havn't used SqlDatasource you need to study ..
Naveed Kamboh
-
If you are beginner then please Read and make sample programs go to ASP.Net and watch some videos.
Naveed Kamboh
-
I want to add a search box on my Site that searches in the from specific column of a database.. Suppose the table consists of columns NAME OF BOOK,PUBLISHER,CATEGORY,FORMAT. it should be like this searchbox (User Input) dropdownlist(to search in specific column) 1)Name of book 2)Publisher 3)category resulting gridview control must contain the results with all the columns iam a beginner...
Hi, Follow the steps below:
Create a following stored Procedure in SQL Server 2000/2005. Give the table name(In the Procedure) you want to queryCREATE PROCEDURE [dbo].[TEST_PARAM] @Param varchar(100) AS BEGIN declare @dynamicQuery NVARCHAR(4000) set @dynamicQuery = 'Select ' + @Param + ' from TABLE_NAME ' exec sp_executesql @dynamicQuery END
2> This above store procedure will return all the values in the column you passed as a parameter. 3> On the server click of the Search button call this stored procedure by passing the columnName as in the table as a parameter and fill the values returned by the stored procedure in a DataSet ds. 4> Any have you know the columnName the user selected, use the same name in the select filter, like:GridView1.DataSource = ds.Tables[0].DefaultView.RowFilter = "ColumName = '" + txtSearchBox.Text.Trim()+ "'";
5> Then the the grid View will be binded with the needed values. Thatz it. :-OM-o-h-a-n