By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,791 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

parentrow

P: 26
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.Count; i++)
{

if (thedata.Tables["Buliding"].Rows[i]["Buliding"].ToString() == comboBox1.SelectedItem.ToString())
{
string x = string.Format("{0}-{1}", comboBox1.SelectedItem.ToString(), fl.ToString());
x = x.Replace(" ", "");
floorsrow["Floor"] = x.ToString();
floorsrow.SetParentRow(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
Feb 12 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.