简体   繁体   English

如何在列中将数据表保存到SQL数据库中,然后在c#中以表格格式检索转换为pdf的数据表

[英]How to save a datatable to SQL database in a column and later retrieve that convert to pdf in a tabular format in c#

I have a requirement where I have to save a datatable to the sql db in a single column and later retrieve that on user action and convert that to pdf which looks exactly like a table. 我有一个要求,我必须将数据表保存到单列中的sql db中,然后在用户操作时检索该数据表并将其转换为看起来像表的pdf。 Request you to suggest the best way for this.. 要求您提出最佳方法。

Mods - Please this is not a duplicated. Mods-请不要重复。 I have to retrieve the data and convert that to a pdf in tabular format. 我必须检索数据并将其转换为表格格式的pdf。

Using MigraDoc as an open source .NET library to export a DataTable to PDF. 使用MigraDoc作为开源.NET库将DataTable导出为PDF。 For exporting data table into pdf please refer here 要将数据表导出为pdf,请参阅此处

And for saving into database 并保存到数据库中

I would create, if possible, a xml field inside the sql database and save the datatable as xml 如果可能的话,我将在sql数据库中创建一个xml字段,并将数据表另存为xml

XML Support in Microsoft SQL Server Microsoft SQL Server中的XML支持

and

C# and Vb.net example for XML data type tips in SQL Server SQL Server中XML数据类型提示的C#和Vb.net示例

should help you 应该可以帮助你

another example took from here 另一个例子是从这里

If it's data save it as data and transform it in the requester's format as you select it. 如果是数据,则将其另存为数据,并在选择时以请求者的格式进行转换。 If its a document save it as a document. 如果是文档,则将其另存为文档。 What you suggest is the worst of all options. 您的建议是所有选择中最糟糕的。

Xml is an option as mentioned but you can't beat actually storing your data as data. 如前所述,Xml是一个选项,但是您不能战胜将数据实际存储为数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM