i have filled a datatable with rows. now i need to insert the rows of the datatable to a table in my database.
how can i do this?
et la 2ayre mahadan yridd!!
views:
63answers:
2
A:
Below will show you how to insert the data into a database.
private void InsertButton_Click(object sender, EventArgs e)
{
Int32 newRegionID = 5;
String newRegionDescription = "NorthEastern";
try
{
regionTableAdapter1.Insert(newRegionID, newRegionDescription);
}
catch (Exception ex)
{
MessageBox.Show("Insert Failed");
}
RefreshDataset();
}
private void RefreshDataset()
{
this.regionTableAdapter1.Fill(this.northwindDataSet1.Region);
}
mbcrump
2010-05-03 18:59:34