Using conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("DatabaseName"))
Dim strSelectCmd As String = "SELECT LastName,FirstName FROM List"
Dim OleDBC As New OleDb.OleDbCommand(strSelectCmd, conn)
conn.Open()
ListofCSOAccredited.DataSource = CSOAccredited()
ListofCSOAccredited.DataSourceID = Nothing
ListofCSOAccredited.DataBind()
End Using
you can create a view in database with the columns you want and then return the results from parameterised stored procedure which should return the results from view based on the search criteria passed.
Databind the gridview in asp with simle bound columns.
You have learnt SQL so now the thing is to select only some columns.
Lets assume you have 5 cols. col_1, col_2, col_3, col_4, col_5 You need to select only 1, 3 and 5 So here is the SQL statement.
"SELECT col_1, col_3, col_5 FROM Table"; // Table will be the name of the table. And if any condition.
// Than use WHERE clause too.
And the search results will be the ones matching. I guess you need to search the Database. Ok, you need this code for that
"SELECT col_1, col_3, col_5 FROM Table WHERE name LIKE '%a'";
// This will search every word starting with a you can see a "%" sign in start. Telling server to search
// Words that start with a. Now you will get the result of col_1, col_3, col_5 only where the words match.
// To show them in a webgrid. Use some table !
Because I am not able to help you in WebGrid. Accept my sincere apologies for that!
Please "Marks As Answer" if any answer helped you out!
~~! FIREWALL !~~
Marked as answer by Angie xu - MSFT on Jan 30, 2013 12:49 AM
venkateshyel...
Member
12 Points
29 Posts
display user search results on ASP.NET page
Jan 22, 2013 12:44 PM|LINK
I have a table with some list of columns, I want to display some of those columns.
Could some one tell me how can I diaplay user search results on ASP.NET page.
BRUTAL JT
Member
161 Points
81 Posts
Re: display user search results on ASP.NET page
Jan 22, 2013 01:31 PM|LINK
You may want to try the tutorials found on this site or you could try this http://www.mikesdotnetting.com/Article/180/Displaying-Search-Results-In-A-WebGrid.
johnSUALOG
Member
2 Points
27 Posts
Re: display user search results on ASP.NET page
Jan 23, 2013 07:49 AM|LINK
try this:
Private Sub BindGridView()
Using conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("DatabaseName"))
Dim strSelectCmd As String = "SELECT LastName,FirstName FROM List"
Dim OleDBC As New OleDb.OleDbCommand(strSelectCmd, conn)
conn.Open()
ListofCSOAccredited.DataSource = CSOAccredited()
ListofCSOAccredited.DataSourceID = Nothing
ListofCSOAccredited.DataBind()
End Using
End Sub
goel.ankit
Contributor
2531 Points
513 Posts
Re: display user search results on ASP.NET page
Jan 23, 2013 08:29 AM|LINK
you can create a view in database with the columns you want and then return the results from parameterised stored procedure which should return the results from view based on the search criteria passed.
Databind the gridview in asp with simle bound columns.
A simple example of gridview ->
http://asp-net-example.blogspot.co.uk/2008/10/gridview-example-how-to-use-gridview-in.html
Ankit
(Please select 'Mark as Answer' if my response has helped you.)
Afzaal.Ahmad...
Contributor
2660 Points
1039 Posts
Re: display user search results on ASP.NET page
Jan 23, 2013 04:28 PM|LINK
You have learnt SQL so now the thing is to select only some columns.
Lets assume you have 5 cols. col_1, col_2, col_3, col_4, col_5 You need to select only 1, 3 and 5 So here is the SQL statement.
And the search results will be the ones matching. I guess you need to search the Database. Ok, you need this code for that
Because I am not able to help you in WebGrid. Accept my sincere apologies for that!
~~! FIREWALL !~~