Generating Crystal report from Remote MS.Access database

saithirun

New member
Joined
Jul 26, 2006
Messages
4
Programming Experience
Beginner
Hi all,
I am working on database project in windows application in that my database is selected at install time. i have placed the database in shared folder in network. How to generate Crystal reports form that databse.
Plz respond to me ASAP.

thanks in advance.
SAI.T
 
Should not be a problem:
Crystal reports can use the same connection strings and datasets you are using in the rest of your project. When you add/remove database to the report you will have a variety of selections to choose from and navigate to.
 
this is my doubt

Thanks for you reply,
Consider if the path of database is "\\sys25\Database\db1.mdb" and this is selected by user at install time. I have stored the path in Registers, and used it in program when ever we want in program i know schema of tables but i dont know the path of the database where it has stored un till user selects the database. But while designing the Crystal report we have to select Table for perticular Report.
i need to supply this(user selected) path to crystal report sothat it can automatically generate the report from that table how can i achive that? plz give me an example.

Thanks in advance.
SAI.T
 
My first reaction to your problem would be to design the report from the data table you will be using and 'PUSH' the data to the report at runtime. It sounds like you will have already accessed the tables and defined the structure. In complex cases, I will create a shared Table, pull information from several different tables to load the report records into the shared table.
Research the 'PUSH' method for crystal reports and you get valuable information there.
Using a public table as the report source is done like this:

somewhere where you store variables - a module called 'PublicVariables' or somewhere:
define the table:
VB.NET:
Public YourDatatable As DataTable
Somewhere in your code load the desired data into that table. It can come from one table or many different tables, doesn't matter how you get data in the table.

when you display or print the report, set the report source to that table:
VB.NET:
Dim YourRpt As New CrystalReport1
YourRpt.SetDataSource(YourDatatable)
CrystalReportViewer1.ReportSource = YourRpt
CrystalReportViewer1.Refresh()
Is that a possible solution to your problem?
 
Hi david,
i have created datatable as per the instructions u have given to me. but while i am geting an exception at this line
"cr.SetDataSource(tbl)" where cr:<crystal reort object>, tbl:<create table using "datatable class">. i have used dataset as datasource to the report object instead of tbl cr.Setdatasource(ds) then it is displaying blank report. So from this i concluded that we have to design report in runtime and we have to sen to that report dynamically.

IS this sounds ok?

Regards,
SA.I
 
AT SOME POINT DID YOU FILL THE TABLE WITH THE DATASET RECORDS?

VB.NET:
YourDatatable = DsDataSetName.Tables("TableName")
I think that will fix the blank report problem.

You can alway bind a grid to the table or the dataset on the form and see if they contains any records, as a quick test.

Hope that helps...
 
I have done like this

hi david
i have created formula fields lest say col1,col2,col3 in design time, i have sent information through run time like
cr.DataDefinition.FormulaFields(0).Text = "'" & tbl.Rows(0).Item("Eid") & "'"
cr.DataDefinition.FormulaFields(1).Text = "'" & tbl.Rows(0).Item("Ename") & "'"
cr.DataDefinition.FormulaFields(2).Text = "'" & tbl.Rows(0).Item("Eage") & "'"

by this way i can see the result but i can't apply formula on col3 it holds "Eage" the formulafield.

Regards
sai.T
 
I would be willing to bet it has something to do with the data types.
It appears to work with the string fields and does not work with what is usually a numeric field.
Verify your data types and make sure they match up, you may need to convert to a string or an integer depending on which way your report is designed.

Hope it helps...
 
Back
Top