Click here to Skip to main content
15,916,846 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello to all
My problem is that i have an Excel file with 2 columns and 5000 records or may be more i uploaded the excel file successfully and bind it with the gridview successfully but now my problem is that is have to save that data from gridview to database but it picks only the records showing in Ist page only. as after biding the excel with gridview user also enter some other information that is required in gridview.
please help me if anyone has solution for this prob.
thanks in advance.
waiting for reply
Posted

hi,

Use datatable to bind data with gridview on save scan gridview & then use bulk upload to save data in database.
 
Share this answer
 
Comments
Amit Jamwal 31-Oct-12 5:44am    
thnx for reply...
gridview is binding with datatable only.....
i am creating datatable from data coming from excel file.......
but after binding gridview user also add some additional data in gridview......
[no name] 31-Oct-12 5:48am    
When user clicks on save scan gridview once update datatable values, then use bulk upload to save data.
Amit Jamwal 31-Oct-12 5:54am    
How to scan gridview can u giv some example..............
Use your custom class and make it [Serializable]
then create your list of data from excel or use Datatable bind grid also store it in in viewstate and retrieve your collection or datatable from viewstate on postback update your collection by user changes restore it in viewstate then finally store it in database using OPENXML.

you can try this article for further help

Serialized collection of classes or List of objects into XML and bulk insert using OpenXML[^]
 
Share this answer
 
Use Table valued parameters to save bulk data from gridview. Refer the links below for an article:
Sending a DataTable to a Stored Procedure[^]
C# and Table Value Parameters[^]
Table-Valued Parameters[^]
Use Table-Valued Parameters (Database Engine)[^]


Hope it helps!
      --Amit
 
Share this answer
 
v2

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