如何使用C#winform中的存储过程创建包含数据的excel文件? [英] How to create excel file with data using stored procedure in C# winform?

查看:109
本文介绍了如何使用C#winform中的存储过程创建包含数据的excel文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,



我是Uday Satardekar,



在C#winform应用程序中,我是使用Datagridview作为数据输入的优秀。



我将这些数据从Datagridview(电子邮件,公司国家等)发送到服务器使用



Xml然后使用存储过程将数据存储到数据库中。





除此之外,我想将这些信息存储在服务器上的excel文件中。并且每次必须创建单独的excel文件。



所以请指导我,如何使用uniq名称创建excel文件并将数据存储在服务器上的同一文件中。我只是用任何名称创建excel使用数据,然后仅使用名称获取excel。



我的服务器位于不同的计算机上。有多台计算机可以访问它。





所以请帮我解决这个问题。

对不起英语不好。



提前谢谢。

Hi Expert,

I am Uday Satardekar,

In C# winform application, i am using Datagridview as excel for data entry.

I am sending these data from Datagridview ( Emails, companies countries etc.) to server using

Xml and then using stored procedure to store the data into database.


Besides this now i want to store these information in excel File on server. And every time it must create separate excel file.

So please guide me ,how to create excel file with uniq name and store data as it is on same file on server.Here i am just creating excel with any name with data and then fetching that excel with name only.

My Server is on different computer.and there are multiple computers accessing it.


So please help me to sort out this problem.
Sorry for poor English.

Thanks in advance.

推荐答案

将数据导出到Excel是一项非常常见的任务。如果你谷歌,你会得到许多体面的例子。以下链接解释了如何将XML数据导出为ex​​cel:



http://social.msdn.microsoft.com/Forums/br/csharpgeneral/thread/ea02f8e8-edf5-4aca-8c74-ef3a9​​4b5328d [<一个href =http://social.msdn.microsoft.com/Forums/br/csharpgeneral/thread/ea02f8e8-edf5-4aca-8c74-ef3a9​​4b5328dtarget =_ blanktitle =New Window> ^ ]



在上面的示例中,数据集转换为XML,然后导出到excel。您可以跳过将数据集转换为xml然后尝试的部分。



一切顺利。
Exporting the data to excel is a quite common task. If you google, you will get many decent examples. The following link explains of exporting the XML data to excel:

http://social.msdn.microsoft.com/Forums/br/csharpgeneral/thread/ea02f8e8-edf5-4aca-8c74-ef3a94b5328d[^]

In the above example a dataset is converted to XML and then exported to excel. You can skip the part of converting dataset to xml and then try it.

All the best.


这篇关于如何使用C#winform中的存储过程创建包含数据的excel文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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