Crystal Reoprts
Hi All,
I have created a Window based application , i have also created a setup and deployment application and made it into a setup file , now i need to create a crystal report application such that it automatically takes the database table from the system.
For Example if i deploy the application and install in the client system and install it in
C:/Program files/application
Now in this folder my database file will be present(I'm using an Access Database .mdb), i need that when the user clicks a button in my application the report must show the table from that database file.
Please anyone help me!
Nilanka DharmadasaPosted Oct 30, 2009, 5:31 AM
I was able to recreate your problem. The error ' report has no table'.
First tell me have you designed a crystal report template ? If so check whether you have set a data table in the template.
The reason for this error is, when you create the crystal report template (.rpt file) you have not set any table. But you try to set a data table from code.It makes no sense. So it gives you an error.
If you want to display a dataset in the report, first you should add a table to the template.
First have a basic idea about crystal reports. There are tutorials on the web.
Sriram RamaniPosted Oct 30, 2009, 4:18 AM
Nilanka DharmadasaPosted Oct 30, 2009, 2:38 AM
Is that so?
Anyway your code is not clear. If you can post it clearly, I can help you.
Sriram RamaniPosted Oct 30, 2009, 12:52 AM
Nilanka DharmadasaPosted Oct 29, 2009, 7:02 AM
Paster your code here. Then your problem will be more clear to us.
Sriram RamaniPosted Oct 28, 2009, 4:59 AM
Nilanka DharmadasaPosted Oct 28, 2009, 1:04 AM
The dataset has only one table.
So you should call like this.
obj.setdaasource(ds.tables(0))
Whne you pass 1 it looks for the second table.
Hope your problem is resolved.
Please do not forget to accept my answer.
Sriram RamaniPosted Oct 28, 2009, 12:15 AM
Girish KulkarniPosted Oct 26, 2009, 10:22 AM
Try this one.
1. Right click on your project and add dataset as a new item. It is called as typed dataset. Now one xsd file will get added into your project.
2. Open xsd file and right click on it and add one table. Simillary add all the columns which you want to show in the report.
Set all the appropriate properties. In this way you are going to create a table which you will directly connect to the database.
eg. You will have a table "Employee" with column "EmpID","EmpName","Address"
3. Use this xsd file as dataset in your crystal report. This dataset(xsd) will help you in designing the project.
4. Now, through coding create instance of this dataset and fill table values dynamically by using queries.
5. Now assign dynamic instance of your dataset to the crystal report and open the report.
I hope it will help you. Please let me know if you want further clarifications or help.
If this answer works for you then please dont forget to Check "DO you like this answer".
Sriram RamaniPosted Oct 26, 2009, 8:20 AM
Sriram RamaniPosted Oct 26, 2009, 8:19 AM
Nilanka DharmadasaPosted Oct 26, 2009, 4:54 AM
The best thing you can do is setting the data source dynamically. You can do this via C# code. If you need my help on that let me know. Better if you can paste your code here so that I can understand your requirement clearly.
If my answer helps you, please accept my answer.
naura paxPosted Oct 26, 2009, 4:52 AM
There is another way of achieving that by using app.config.
You can define configuration string there and by using it you can access it in your data access layer.
So instead of directly setting ms access file as datasource you can set a DataSet as datasource for your crystal report. That dataset can be filled at runtime using sql queries on ms access db.
hope i'm close this time
bebo
Sriram RamaniPosted Oct 26, 2009, 4:25 AM
naura paxPosted Oct 26, 2009, 3:51 AM
If you have vs , crystal report will be available right there.
For eg in visual studio 2005 you open your window project and reference to following: C:\WINDOWS\assembly\GAC\CrystalDecisions.Enterprise.Framework\10.2.3600.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll
C:\WINDOWS\assembly\GAC\CrystalDecisions.Enterprise.Framework\10.2.3600.0__692fbea5521e1304\CrystalDecisions.Enterprise.Framework.dll
and you can directly add a file of type crystal report in your window application and directly set table from your database in that report file.
Later you'll have to build forms from where you can access these reports by using
ReportViewer class objects.