class CodeProject_Solution
{
SqlConnection con = new SqlConnection("your constring");
SqlCommand cmd = new SqlCommand("select * form CoursesLines");
DataTable dtTemp = new DataTable();
private void UpdateSolution()
{
con.Open();
cmd.Connection = con;
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
builder.ConflictOption = ConflictOption.OverwriteChanges;
adapter.Fill(dtTemp);
}
private void AddMultiValues()
{
for (int i = 0; i < 50; i++)
{
DataRow dr = dtTemp.NewRow();
dr["FId"] = "id" + i;
dr["CoursID"] = "CoursID" + i;
dr["CoursDescr"] = "CoursDescr" + i;
dtTemp.Rows.Add(dr);
}
dtTemp.AcceptChanges();
UpdateSolution();
}
}
if any query please let me know.
Thanks.
helping link.
Updating Data Sources with DataAdapters