ASP.NET - how to insert datatable records into database

Asked By sri on 15-Oct-12 03:27 AM
Hi to All,

 i have a datatable it contains 10 records in it. i wnat to insert these 10 records into database. plz tell me how to insert it.
Venkat K replied to sri on 15-Oct-12 01:47 PM
using (var command = new SqlCommand("InsertTable")
{CommandType = CommandType.StoredProcedure})
{ var dt = new DataTable(); //create your own data table command.Parameters.Add(new SqlParameter("@myTableType", dt)); SqlHelper.Exec(command); }

and write a stored procedure which inserts the records into table.