Click here to Skip to main content
15,914,452 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In a Grid View multiple records are displayed.

Now, I need to saved all records into database at single hit means on a button click without using loop.
Posted
Comments
OriginalGriff 3-Nov-14 6:38am    
And?
What have you tried?
Where are you stuck?
Maciej Los 3-Nov-14 6:40am    
What kind of database? What portion of data?
AshishvermaMCA 3-Nov-14 6:44am    
All records which are displayed into Grid View.
Suppose 20 records is displayed . I need to save 20 records into database sql server on a click of button without implementing loop functionality.

1 solution

If you're using SQL server as database server, you can use SqlBulkCopy class[^].

For further information, please see:
Bulk Copy Operations in SQL Server[^]
Transferring Data Using SqlBulkCopy[^]
SQL Bulk Copy with C#.Net[^]
 
Share this answer
 
Comments
Peter Leow 3-Nov-14 9:38am    
5ed!
Maciej Los 3-Nov-14 10:00am    
Thank you, Peter ;)

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