Click here to Skip to main content
15,896,487 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how could i do this with the help of datareader
Posted

1 solution

Your question is not clear. Anyway I'm writing an example to read the particular column value from DB and bind with DataGridView.
C#
SqlConnection conn = new SqlConnection("Data Source=;Initial Catalog=;Persist Security Info=True;User ID=;Password=");
conn.Open();

String query="Select [ColumnName] from [table1]";

SqlDataAdapter da = new SqlDataAdapter(query, conn);
DataSet ds = new DataSet();
da.Fill(ds);
this.GridView1.DataSource = ds.Tables[0];
this.GridView1.DataBind();

conn.Close();
 
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