Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
we have an application which generates the report into excel format.I have a requirement to develop an application to import the excel file report into a SQL database tables using C# windows application.

There are few points to keep in mind.

1. The application should be dynamic to cover a new column added or a existing column removal in the report. for example i have a report for student details having Roll No, Age, Name in the excel file and my database table Student is also having column like ROLLNo,Age,Name. So if in future they add a new column to the report say "Student Department" then the application should be able to cover this changes without any code changes in the existing application. The application should be configured to cover this change dynamically.

2. The name of the columns in excel and sql database table would be different

Please suggest is there a way to achieve this in c# using winform application

1 solution

It should be 3 step process

1. You can induce the intelligence at stored procedure level which actually inserts the data in your tables
2. You can store mapping between excel columns and stored procedure in an xml file
3. Your presentation layer would be simple that is reading the xml report and invoking the xml

Share this answer
superselector 19-Aug-13 1:40am    
Hi Thanks for your response.. but how am i going to check for new columns in DB tables. shall i check for the existense of table in the column mapping xmls and create the column. and how can handle the removal of column from database without affecting the existing data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900