Solved

Import excel data to sql database using a c# service

Posted on 2007-11-29
2
469 Views
Last Modified: 2008-02-01
I am looking to find some sample c# code that will help me understand how to take data from and excel sheet and insert into a table in an sql database. Basically, I have an ap that the user can browse for the saved excel file, then click an upload button to process the insert. The excel sheet has aprox 16000+ rows and some of the data will have blank fields, so I would like to add a check in the code to catch the blank fields.Thanks for the help
0
Comment
Question by:matzilla
2 Comments
 
LVL 15

Accepted Solution

by:
Solar_Flare earned 250 total points
Comment Utility
you can query an excel file using SQL with JET

http://support.microsoft.com/kb/311731

you would need to save the uploaded file temporarily so you can query it with JET. Once you get your results you can loop through them checking for nulls and inserting them into your DB.
0
 

Author Comment

by:matzilla
Comment Utility
Cool, thats exactly what I needed to get started. Thanks
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
problem with vb editor in excel 2016 10 24
VBA Code Mixed Combining Two User Forms 7 37
Thanks for the advise, but... 4 24
Excel 3 20
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now