Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how bind data from table with gridview.
Posted

hi,
if you use Dataset, please use code like this

C#
DataSet ds=new DataSet();
SqlDataAdapter dataadpt=new SqlDataAdapter(cmd);
dataadpt.Fill(ds);
//now we bind data to grid view
Gridview1.DataSource=ds;
Gridview1.Databind();


if you use DataTable,
same as dataset.but small difference is
C#
Gridview1.DataSource=ds.Tables[0];
Gridview1.Databind();


because Collection of Datatable is called as DataSet.

Hope this is useful to you,

Thanks and regards
Angappan.S
 
Share this answer
 
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...

A very quick search gave over half a million hits: bind data from table with gridview[^]
The top link looks interesting!

In future, please try to do at least basic research yourself, and not waste your time or ours.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900