C# .NET - dataset relations - Asked By ramar yadav on 14-Sep-12 12:17 AM

hi sir.. 


 dataset relations two table (customer and orders) details using gridview in c# asp.net
how to set. pls kindly help me sir.. any sample code reply sir. pls sir
Jitendra Faye replied to ramar yadav on 14-Sep-12 12:23 AM
For that use join while getting data, and after that you can assign result to GridView.


like this-

SqlConnection con = new SqlConnection("con string ");
SqlDataAdapter da;

string mySQL = "Your join Query";

da = new SqlDataAdapter(mySQL, con);
DataSet ds = new DataSet();
da.Fill(ds);

GridView1.DataSource=ds;
GridView1.DataBind();


Try this and let me know;.