Solved

Import data from Excel to SQL Server through ASP.net C# - with validation

Posted on 2010-08-31
1
730 Views
Last Modified: 2012-05-10
Hi!

After the solution in Related Question was implemented, I was wondering if there any way to validate if the Excel sheet has the same structure of the table.

Is possible to validate this?

Thanks in advance!
0
Comment
Question by:calypsoworld
1 Comment
 
LVL 16

Accepted Solution

by:
carsRST earned 500 total points
ID: 33569392
Depends on what you mean by same structure.  If you mean column headers, you would use the Excel API to open the file and read each header and compare to database.  

Data type is another issue.  When you import as you're doing on the previous question, data type is determined by the first few rows.  If you need to test for sure, then you would also need to open the Excel file (see sample code) and perform a test on the sheet in the file.

Here's some sample code for opening an Excel file from c#.
http://support.microsoft.com/kb/302084
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

23 Experts available now in Live!

Get 1:1 Help Now