如何将mysql数据导出为pdf [英] How do I export mysql data into pdf

查看:569
本文介绍了如何将mysql数据导出为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很高兴,我的查询关于如何使用csharp库将mysql数据导出到pdf文件中,就像有两个日期时间选择器和一个按钮用户从两个日期时间选择器事件中选择日期并单击按钮它将获取日期从mysql数据库并将所选数据导出到pdf文件中。是否有任何第三方平台可用,如itextsharp?任何参考?请提前帮助。

HI i am joy,my query about how to export mysql data into pdf file using csharp library,like there are two datetime picker and a button user select date from two datetime picker event and click on the button and it will fetch date from mysql database and export selected data into pdf file.Is there any third party platform available like itextsharp? any reference ? Please help thanks in advance.

推荐答案

你没有问过一个问题。这是一系列问题。请检查以下问题的细分问题,并链接到解决方案。



1。如何使用C#从MYSQL中检索数据?

参考:

从MySQL数据库中检索数据 [ ^ ]

使用C#和.NET连接到MySQL数据库 [ ^ ]

2。如何在datepicker中选择的日期之间过滤MySQL数据?

只需在SELECT查询中添加正确的WHERE子句即可。类似的事情 -

You haven't asked a single question. It's a set of many questions. Please check following breakdown of your question to simple questions and link to the solution.

1. How to retrieve data from MYSQL using C#?
Reference:
Retrieving Data From a MySQL Database[^]
Connecting to MySQL Database using C# and .NET[^]
2. How to filter MySQL data between the dates selected in datepicker?
Just add a correct WHERE clause to your SELECT query. Something like-
"WHERE yourDateColumn >='"+dateTimePicker1.Value.ToString("yyyy-MM-dd")+" 00:00:00"+"' AND yourDateColumn <='"+dateTimePicker2.Value.ToString("yyyy-MM-dd")+" 23:59:59"+"'"



3。如何使用iTextSharp创建PDF?

参考:

将DataSet或DataTable导出为Word Excel PDF和CSV格式 [ ^ ]

使用iTextSharp创建基本PDF [ ^ ]



注意:不要使用易受SQL注入攻击的内联查询。我使用这些来使答案简单易懂。使用参数化查询或存储过程来避免SQL注入。



希望,它有帮助:)


3. How to create PDF using iTextSharp?
Reference:
Export DataSet or DataTable to Word Excel PDF and CSV Formats[^]
Basic PDF Creation Using iTextSharp[^]

Note: Don't use inline queries which are vulnerable to SQL Injection. I have used these to make the answer simple to understand. Use Parameterized query or Stored Procedure to avoid SQL Injection.

Hope, it helps :)


这篇关于如何将mysql数据导出为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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