Solved

Import excel data to sql database using a c# service

Posted on 2007-11-29
2
471 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
ID: 20377882
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
ID: 20381650
Cool, thats exactly what I needed to get started. Thanks
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

772 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