Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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)
SELECT
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
Reply With Quote
  #2 (permalink)  
Old February 17th, 2009, 09:09 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Get RID of your connection to Excel.

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

Read this:
http://msdn.microsoft.com/en-us/libr...9(SQL.80).aspx

see the reference there to OPENDATASOURCE and follow the link to
http://msdn.microsoft.com/en-us/libr...5(SQL.80).aspx

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


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 04: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 10:30 AM
Enumerate SQL data sources RFickling C# 0 May 22nd, 2005 11:49 AM
Query from multiple data sources billmedd BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 September 27th, 2004 11:46 AM



All times are GMT -4. The time now is 02:26 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.