简体   繁体   中英

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. Request you to suggest the best way for this..

Mods - Please this is not a duplicated. I have to retrieve the data and convert that to a pdf in tabular format.

Using MigraDoc as an open source .NET library to export a DataTable to PDF. For exporting data table into pdf please refer here

And for saving into database

I would create, if possible, a xml field inside the sql database and save the datatable as xml

XML Support in Microsoft SQL Server

and

C# and Vb.net example for XML data type tips in SQL Server

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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