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...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Sep 26, 2013, 2:04 AM
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
shibasankar beheraPosted Sep 26, 2013, 2:00 AM
Posted Sep 26, 2013, 1:53 AM
shibasankar beheraPosted Sep 26, 2013, 1:51 AM
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 26, 2013, 1:09 AM
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.