Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 10, 2012 02:42 PM by fimine
Aug 08, 2012 01:38 PM|LINK
I am stuck with this unique problem.. I have this requirement of Inserting Data from Excel Sheet to SQL Server..
I am currently using Microsoft Web Developer 2005 Express, SQL SERVER Express 2005 and Microsoft Excel 2007 (Its version is 12.0 i guess)..
I have done a lot of research in this topic but could not find anything suitable..
I want to insert the path of excel file using File Upload control and when the user clicks the button the Record in the sheet1 of that excel
sheet should get inserted into the relevant table into the database..
The system should work for entering many data simultaneously into the database...
Please suggest a simple way to achieve this goal..
Any relevant links are Welcomed...
Thanks and Regards,
Aug 08, 2012 01:43 PM|LINK
Aug 08, 2012 01:57 PM|LINK
Thanks Basquiat for your suggestion..
But How could you seperate multiple data from xcel sheet get separated by comma..???
Another thing is that I want the end user to just insert his excel file and upload the associated data into the database...
Aug 08, 2012 02:07 PM|LINK
Upload your file to a common locatoin, where your app has permission.
Then use Data connection to excel (see here: http://www.connectionstrings.com/excel)
simply select from excel into sql.
Since you're dealing with common server location for all users, rename your files to GUID or use sessionId for file names. Don't forget to cleanup the folder.
Aug 09, 2012 05:12 AM|LINK
Thank You fimine for your response... I want to know more about this.. Do you have any relevant links...
My problem is I always use connection strings in web.config and I have not used it any webpages..
The Second thing is that since the file name always changes how could i configure it in my codes...
Any more relevant information...
Aug 09, 2012 06:51 AM|LINK
Any More Suggestion for achieving this goal guys...
Aug 09, 2012 08:04 AM|LINK
It is little bit hard to give a complete sample. Here is the way to read data from multiple Excel Sheets into a DataTable. Then save this DataTable to table in DB:
Aug 10, 2012 02:42 PM|LINK
This shouldn`t be superhard espceially for "genius vishal". Just set your connection string dynamically in your command object