Crystal Reports Using Local Database
I receive one comment on one of my post “How to Print Using Crystal Reports” asking on how to create a crystal reports using a local database.
I told him to create a video on this, but I decided to create a project before I publish the video.
Local database has an extension filename “.sdf”. By default you cannot see it (Data Source) when you create crystal reports using a wizard.
There is no other way of displaying a report from local database other than hard coding.
You need to import “System.Data.SqlServerCe” in order to print crystal reports using local database.
Here’s the code to populate the DataSet in order to display the reports when you preview it.
- Dim sqlQRY As String = "SELECT * FROM Customers"
- Dim cmdExec As SqlCeCommand = New SqlCeCommand(sqlQRY, conn)
- 'create data adapter
- Dim da As SqlCeDataAdapter = New SqlCeDataAdapter(sqlQRY, conn)
- 'create dataset
- Dim ds As DataSet = New DataSet
- 'fill dataset
- da.Fill(ds, "Customers")
- Dim Report As frmReports = New frmReports
- Dim mReport As rptCustomers = New rptCustomers
- mReport.SetDataSource(ds)
- Report.CrystalReportViewer1.ReportSource = mReport
- Report.ShowDialog()
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
Comments
I think thats me .. xD ..
Not Working
Try to change the target cpu
I manage to debug it
did you attached the database
i think i didn't
why does my crystal report
can you send me the link of
crystaldecisions.reportsource.reportsourcefactory
Add new comment
- Add new comment
- 494 views