keyongtech


  keyongtech > data.* > data.ado > 10/2003

 #1  
10-24-03, 08:58 PM
PhilGreg
I don't know if all C++ users are as frustrated as I am by
the inexistent documentation of CR for C++, but I'm trying
to use the equivalent of the
Report.AutoSetUnboundFieldSource (in VB), which allows to
bind unbound fields in a report at runtime to an ADO
Recordset.
Please also answer by e-mail if you can be of any help.
Thanks a lot!
 #2  
10-25-03, 01:32 AM
Ross McKay
On Fri, 24 Oct 2003 12:58:30 -0700, "PhilGreg"
<philippe.gregoire> wrote:

>I don't know if all C++ users are as frustrated as I am by
>the inexistent documentation of CR for C++, but I'm trying
>to use the equivalent of the
>Report.AutoSetUnboundFieldSource (in VB), which allows to
>bind unbound fields in a report at runtime to an ADO
>Recordset.
>Please also answer by e-mail if you can be of any help.


G'day Philippe,

I don't know exactly what your approach is, but for the ADO-based
reports I've written I use the following code (VB) to set the data
source:

Private m_crystal As CRAXDRT.Application
Private m_report As CRAXDRT.Report
...
Set m_crystal = New CRAXDRT.Application
Set m_report = m_crystal.OpenReport(report_file)
m_report.Database.SetDataSource rs, 3, 1
...
m_report.PrintOut False, 1, True


In the call to SetDataSource, the second parameter must be 3 to
designate the source as ADO. The third parameter is 1 in this example to
indicate which "table" in the report is being set to the recordset.

If you have multiple "tables" in your report, you change the first and
third parameters on subsequent calls. I tend to just do the work in the
database and present a single ADO recordset to the report though.

If your report has sub reports, you can do the same thing by acquiring a
handle to the subreport and calling SetDataSource:

Dim subrpt As CRAXDRT.Report

Set subrpt = m_report.OpenSubreport(subrpt_name)
subrpt.Database.SetDataSource rs, 3, table_index
Set subrpt = Nothing

HTH,
Ross.
Similar Threads
Data binding a Crystal report to an object in a web app

Hello, We want to use Crystal Reports to print a page with customer info. However, we cannot connect a new report to our object! We have looked at the samples and done the...

Binding a dataset to Crystal Reports at Runtime

I tried to bind a dataset to a crystal report(Windows form) at runtime as follows: Dim obj as crystalreport1 obj.setdatasource(ds.tables(0)) The problem is though dataset...

Binding DataTable to a Crystal Report

Hi, Which is the best way to bind DataTable to a Crystal Report in Winforms application. I am using a stored procedure to get the dataset. But I could'nt find a proper...

Crystal Report Data Binding problem

HI, I have a problem in Crystal Report with VS.NET 2003. I am adding data to the report at design time. The problem is that I have 2 databases. First I ran report with First...

Crystal Report binding with Dataview for runtime sorting

Hi, I am trying to sort the data in my crystal report at runtime. The problem is that i can only query the database once and that is at the loading of the report. At that...


All times are GMT. The time now is 11:28 AM. | Privacy Policy