I want to create columns according to database items..
How to add columns in gridview programmatically?
hey Bosses, I have created a gridview. And I have to bind that gridview with database...
5 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Posted Sep 25, 2013, 10:04 PM EDT
http://blog.sqlauthority.com/2008/06/07/sql-server-pivot-and-unpivot-table-examples/
http://www.codeproject.com/Tips/500811/Simple-Way-To-Use-Pivot-In-SQL-Query
Posted Sep 25, 2013, 9:09 PM EDT
Code snippet:
SqlConnection con = new SqlConnection(Connectionstring);
SqlCommand cmd = new SqlCommand(con);
cmd.CommandText="select * from table1";
SqlDataAdapter adap = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adap.Fill(ds);
gridview1.DataSource = ds.Tables[0];
Hope this helps you.
shibasankar behera102 reputationPosted Sep 25, 2013, 9:51 PM EDT
suppose I am selecting Item(Book), Values are(Max Supply Time, Delivery Type(y/n), Min Supply Time)...
I want these three values will come as columns..
PPlz give some solutions. Thank u
Posted Sep 25, 2013, 9:53 PM EDT
shibasankar behera102 reputationPosted Sep 25, 2013, 10:00 PM EDT