For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > October 2005 > Insert records from Excel









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Insert records from Excel
Mardy

2005-10-30, 7:00 pm

Hello

I'm working on code to upload an Excel file, read the spreadsheet contents
into a datagrid, then ultimately insert each row into a sql server database.

Currently I have the file upload and datagrid functionality working. I'm now
trying to determine the best way to get the data from the dataset that
populates the datagrid into sql server.

I know that there is a dts option but would like to do this without using
dts.

I'm guessing that there is a way to loop through the datagrid and build a
string for an insert statement but am wondering if it would be possible to
use the existing dataset and associated table and a second adapter to the db
to complete the upload.???

Thanks
john_teague

2005-10-30, 7:00 pm

I think the standard way would be to use a DataSet for the datasource
and then a data adapter that has all of the insert/update/delete
methods defined for it and use the data adapter to insert new rows
added to the dataset.

john_teague

2005-10-30, 7:00 pm

I think the standard way would be to use a DataSet for the datasource
and then a data adapter that has all of the insert/update/delete
methods defined for it and use the data adapter to insert new rows
added to the dataset.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com