المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Binding 2 data tables to a single data grid



C# Programming
08-25-2009, 03:00 PM
How to bind two data tables which are in the same dataset to a datagrid????Below is tha code i've written so far

OleDbDataAdapter da_pay = new OleDbDataAdapter();
DataSet ds_pay = new DataSet();
OleDbCommand pay_cmd = new OleDbCommand("select Group from group_details where [Group]='"+descriptiondpdwnlist .SelectedItem .Value +"'",con2);
da_pay.SelectCommand = pay_cmd;
da_pay.Fill(ds_pay,"bill_group");
DataTable pay_dt=ds_pay .Tables ["bill_group"];
OleDbCommand pay_cmd1 = new OleDbCommand("select Description from description_details where [Description]='"+descrptndpdnlt .SelectedItem .Text +"'",con2);
da_pay.SelectCommand = pay_cmd1;
da_pay.Fill(ds_pay ,"Bill_description");
DataTable pay_dt1=ds_pay .Tables ["Bill_description"];
con2.Close();