private dataview createdataview()
{
sqldataadapter cmd=null;
dataset ds=null;
string cmdselect = “select * from table1”;
string cmdselect1 = “select * from table2”;
cmd = new sqldataadapter(cmdselect, conn);
ds = new dataset();
cmd.fill(ds, “account”);
if(conn.state != connectionstate.closed)
conn.close();
cmd=new sqldataadapter(cmdselect1, conn);
cmd.fill(ds, “account1”);
datatable dtparent=ds.tables[“account”];
datatable dtchild=ds.tables[“account1”];
datarow dr;
for(int i=0;i<dtchild.rows.count;i++)
{
dr=dtparent.newrow();
for(int j=0;j<dtparent.columns.count;j++)
{
dr[j]=dtchild.rows[i][j];
}
dtparent.rows.add(dr);
}
return ds.tables[“account”].defaultview;
}