1
Answer

Get data from database, pass this data with grid columns?

Mahmoud Omar

Mahmoud Omar

8y
189
1
i want Get values or data from database and pass every columns from database with columns that i add it in gridview.
 
i used this cold but this code don't  give me what i want :-
 con.Open(); SqlCommand cmd = new SqlCommand("Select code,Name,Salary,desc FROM tableName", con); SqlDataReader dr = cmd.ExecuteReader(); GridView1.DataSource = dr; GridView1.DataBind();         con.Close();
 How i cgange this code and pass this columns(code ,Name ,salary ,Desc) to the columns that i add it in gridview 
Answers (1)