Dear all
My question is mixed between c# and sql so I would perfere to ask here
I want to insert data in sql database but by using C# language...and I two table with relationship between them...the first one has a parent row of the sec. one and the vice versa..the sec. one has childrow of the first one
to insert the data by these philosopy I used dataset..then I update the data in the sql server....
like
DataRow floorsrow = floors.NewRow() ;
for (int i = 0; i < Buliding.Rows.C ount; i++)
{
if (thedata.Tables["Buliding"].Rows[i]["Buliding"].ToString() == comboBox1.Selec tedItem.ToStrin g())
{
string x = string.Format(" {0}-{1}", comboBox1.Selec tedItem.ToStrin g(), fl.ToString());
x = x.Replace(" ", "");
floorsrow["Floor"] = x.ToString();
floorsrow.SetPa rentRow(thedata .Tables["Buliding"].Rows[i]);
floors.Rows.Add (floorsrow);
}
}
bulidingadapter .Update(thedata , "Buliding") ;
so the question how could l inset this data with this relation directly to the database without using dataset
thanks
My question is mixed between c# and sql so I would perfere to ask here
I want to insert data in sql database but by using C# language...and I two table with relationship between them...the first one has a parent row of the sec. one and the vice versa..the sec. one has childrow of the first one
to insert the data by these philosopy I used dataset..then I update the data in the sql server....
like
DataRow floorsrow = floors.NewRow() ;
for (int i = 0; i < Buliding.Rows.C ount; i++)
{
if (thedata.Tables["Buliding"].Rows[i]["Buliding"].ToString() == comboBox1.Selec tedItem.ToStrin g())
{
string x = string.Format(" {0}-{1}", comboBox1.Selec tedItem.ToStrin g(), fl.ToString());
x = x.Replace(" ", "");
floorsrow["Floor"] = x.ToString();
floorsrow.SetPa rentRow(thedata .Tables["Buliding"].Rows[i]);
floors.Rows.Add (floorsrow);
}
}
bulidingadapter .Update(thedata , "Buliding") ;
so the question how could l inset this data with this relation directly to the database without using dataset
thanks