Click here to Skip to main content
15,905,420 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi Frnds,
I have 50 rows in datatable in C# Class file.i need to pass that datatable to stored procedure.i need to read one by one row in stored procedure and update the sql table values.I checked many links i am not getting proper answer.
Posted

1 solution

First create SqlTable Like Ur datatable
Then excute following lines

C#
DataTable YouTableValues= new DataTable();

  SqlBulkCopy bulkInsert = new SqlBulkCopy(strConnString);
   bulkInsert.DestinationTableName = "DestinationTableName"
   bulkInsert.WriteToServer(table);
 
Share this answer
 
Comments
itsureshuk 7-May-13 7:35am    
At a time many users are using so ,if table name is same ,values for every user is different ,mismatch come or not
KM Perumal 7-May-13 7:43am    
Ya You can insert into Same table names
itsureshuk 7-May-13 9:15am    
can u give some example links...i ddnt know proper answer.
KM Perumal 8-May-13 0:44am    
Ya show you data table i ll give sugg

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900