Sunday, November 4

Crystal Reporting (WPF Application + MYSQL Database) Complete Guide

to generate crystal report in wpf c# application is little difficult. first of all read all requirements about platform you are using. Make sure that you have added following assemblies.

Windows 7 64bit
WPF application
MYSQL database
MYSQL ODBC connector 32bit

make sure you have installed MYSQL ODBC connector. if there is mismatch of driver and application let say mysql ODBC is 64Bit/32Bit and wpf application is off 32Bit/64bit repectively then you will face this mismatch issue. to resolve this go to C:\Windows\SysWOW64 and run odbcad32.exe file if you have installed MYSQL ODBC connector 32bit on your PC. now create datasource like this:

now open visual studio and create wpf application. add crystal report on your project. as crystal report viewer os windows form component. go to Project from menu bar. click on project properties. and set target framework to .NET framework 4. now add xml in your window tag of WPF.

in your grid tag

        <WindowsFormsHost Margin="0,12,0,0" Name="windowsFormsHost1">
            <winform:CrystalReportViewer x:Name="rptviewer" />
and now create crystal report on your project.

create an instance of your crystal report like this:
   CrystalReport1 e = new CrystalReport1();
            rptviewer.ReportSource = e;

No comments:

Post a Comment