动态导入SQL数据库表中的Excel数据的机制 [英] mechanism to import excel data in SQL database table dynamically

查看:68
本文介绍了动态导入SQL数据库表中的Excel数据的机制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个应用程序可以生成excel格式的报告。我需要开发一个应用程序,使用C#windows应用程序将excel文件报告导入SQL数据库表。



要记住几点。



1.应用程序应该是动态的,以涵盖添加的新列或现有的列删除报告。例如,我有一个学生详细信息的报告,其中包含滚动编号,年龄,名称在excel文件和我的数据库表格中,学生也有像ROLLNo,Age,Name这样的列。因此,如果将来他们在报告中添加一个新列说学生部门,那么应用程序应该能够覆盖此更改,而无需在现有应用程序中进行任何代码更改。该应用程序应配置为动态覆盖此更改。



2. excel和sql数据库表中列的名称将不同



请建议有没有办法在c#中使用winform应用程序实现这一点

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

推荐答案

应该是3步过程



1.您可以在存储过程级别实现智能,实际将数据插入表中

2.您可以存储excel列之间的映射并存储xml文件中的过程

3.您的表示层很简单,即读取xml报告并调用xml



谢谢

Asif
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

Thanks
Asif


这篇关于动态导入SQL数据库表中的Excel数据的机制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆