tags:

views:

63

answers:

2

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!!

A: 

You will need a TableAdapter to write the data into the database.

Obalix
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