Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Comments
Richard MacCutchan 11-Dec-15 4:29am    
Yes, iTextSharp is the most commonly used library.

1 solution

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-
C#
"WHERE yourDateColumn >='"+dateTimePicker1.Value.ToString("yyyy-MM-dd")+" 00:00:00"+"' AND yourDateColumn <='"+dateTimePicker2.Value.ToString("yyyy-MM-dd")+" 23:59:59"+"'"

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 :)
 
Share this answer
 
v2
Comments
Member 11433175 11-Dec-15 8:35am    
hi suvendu thanks for your response . I am sorry for not clear myself.

What i want : I want to export mysql data in a pdf file,how to do that?

I know about itextcharp library export pdf file but i am not sure that it can write data into a pdf file from mysql database.
suvendu thanks once again for your response.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900