Apply Changes to the Database

2 posts, 0 answers
  1. Rasha
    Rasha avatar
    4 posts
    Member since:
    Apr 2013

    Posted 09 May 2013 Link to this post

    Hey guys,
    Could you please help me with this example

    how can I update the database using the data table in the example, please reply...
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 May 2013 Link to this post

    Hi Rasha,

    Try the following.
           SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ToString());
         string name=changedRows[0][columnname].ToString();
         string updateQuery="update tblename set name='"+name+"' where ProductID=changedRows[0][ProductID].Tostring()";//to update;
          SqlCommand cmd = new SqlCommand(updateQuery, con);

  3. DevCraft R3 2016 release webinar banner
Back to Top