i just the beginner.My db is using MS SQL server 2008
How to return multiple at the same time using DataGridView for C#.net
Collapse
X
-
1. Write query
2. Execute query
3. Save data in DataTable
4. Bind DataTable to Gridview
Have fun figuring it out!
StevenComment
-
See my first post:
1. Write query
2. Execute query
3. Save data in DataTable
4. Bind DataTable to Gridview
StevenComment
-
General this is how i do query's in asp.net.
First you must make sure you load the assembly to your page.
Then declare a connection, command, datatable, and a dataadapter.Code:using System.Data.SqlClient;
Hope this helpsCode:SqlConnection con = new SqlConnection("connectionstring"); SqlCommand cmd = new SqlCommand("put command here", con); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); GridView.DataSource = dt; GridView.DataBind();Comment
-
Please review the following article that outline how to use a database:
Database tutorial Part 1
Database tutorial Part 2Comment
Comment