This is a migrated thread and some comments may be shown as answers.

Apply Changes to the Database

1 Answer 39 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Rasha
Top achievements
Rank 1
Rasha asked on 09 May 2013, 01:25 PM
Hey guys,
Could you please help me with this example 
http://www.telerik.com/help/aspnet-ajax/listview-manual-editing.html

how can I update the database using the data table in the example, please reply...
Thanks, 
Rasha

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 May 2013, 04:29 AM
Hi Rasha,

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

Thanks,
Princy.
Tags
ListView
Asked by
Rasha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or