Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello sir i m try to show dataset values in datagrid view control.condition is that "before calling dataset i allredy created Datagridview column" and i want whenever i call Dataset then values show on my existence column not create another column....

so plz help me this problem....
Posted

1 solution

I solve my self........


C#
SqlConnection con = new SqlConnection("Data Source=.; Initial Catalog=sham; Integrated Security=True");
            con.Open();
            SqlDataAdapter da = new SqlDataAdapter("Select Name,Address from Employee", con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            CustName.DataPropertyName = "Name";
            CustAddress.DataPropertyName = "Address";
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource = ds.Tables[0].DefaultView;
 
Share this answer
 
v4

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