public void FillMyDataSet(MyDataSet ds)
{
string sql = "SELECT a.*, b.* FROM MyTable a JOIN MyOtherTable b ON a.key = b.key";
using (SqlDataAdapter da = new SqlDataAdapter(sql, conn))
{
da.Fill(ds, "MyTable");
}
}
MyDataSet dsMine = new MyDataSet();
this.FillMyDataSet(dsMine);
MyGridView.DataSource = dsMine;
Or you can try this code.... table mapping is awesome one..
SqlDataAdapter adapter = new SqlDataAdapter(
"SELECT * FROM Customers; SELECT * FROM Orders", connection);
adapter.TableMappings.Add("Table", "Customer");
adapter.TableMappings.Add("Table1", "Order");
adapter.Fill(ds);