Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 17th, 2009, 07:42 PM
Registered User
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default combining two data sources

Hello All,

I'm working in asp and I have two different connections strings, one to an excel file and one to a ms sql server database. what I want to do is copy the data from the excel file to the ms sql server. In order to do so I have to upload the excel file and then read the data from it. I've got that part figured out, but how would I copy data from the excel file to the ms sql server database? Any ideas would be greatly appreciated.

already constructed the sql statement. it looks like this:

INSERT INTO tblleadmanagement
(strfirstName, strlastname, straddress1, strcity, strstate, intzipCode, strphone1, strworkPhone, strhouseType, intCurrentValue, intloanAmount, intfirstBalance, intrate, strfixAjustable, strbehind, strcredt, stryearlyIncome, strbestTimetoCall, strloanDesired, str1stmortageLender, int1stmortgagePayment, intmonthsBehind, strnoticeOfDefault, dtforeclosureDate, stremailAddress, dtdate, strcomments)
Name, [Last Name], Address, City, St, Zip, [Home Phone], [Work Phone], [House Type], [Current Value], [Loan Amount], [1st Balance], Rate, [Fix/Adj], Behind, Credit, [Yearly Inc], [Best Time to Call], [Loan Desired], [1st Mortgage Lender], [1st Mortgage Payment], [Months Behind], [Notice of Default], [Foreclosure Date], [Email Address], [Date], Comments
FROM exceltable
Old February 17th, 2009, 09:09 PM
Friend of Wrox
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

Get RID of your connection to Excel.

Instead, create that connection *INSIDE* your SQL Server statement!

Read this:

see the reference there to OPENDATASOURCE and follow the link to

The second example there even uses a spreadsheet as the source of the SELECT.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: IListSource not contain any data sources. cJeffreywang ASP.NET 2.0 Basics 1 October 17th, 2007 03:04 PM
Joining data from multiple data sources ClaesR BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 August 28th, 2006 09:30 AM
Enumerate SQL data sources RFickling C# 0 May 22nd, 2005 10:49 AM
Query from multiple data sources billmedd BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 September 27th, 2004 10:46 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.