Tuesday, March 27, 2012

Field Definition report results no record

Hi guys, sorry my poor english,
I'm trying to create a simple example of a report that receive the recordset from my VB6 application. The recordset have only one field like the rpt and the ttx file.

My project use these references:
Microsoft Remote Data Object 2.0
Crystal Reports ActiveX Designer Run Time Library 10.0
Crystal Report Viewer Control

To reproduce the example in VB, create a new project, include the references, create a command button and a CRViewer and after paste the code inside the form.

--- Code ---
Option Explicit
Dim cnFin As RDO.rdoConnection
Dim Crystal As CRAXDRT.Application

Private Sub Command1_Click()
Dim rsFin As RDO.rdoResultset
Dim rpFin As Report

'Opening table
Set rsFin = cnFin.OpenResultset( _
"SELECT ALL FinCPSequencia " & _
"FROM FinMovtoPagar " & _
"WHERE CodEstab = 5", RDO.rdOpenKeyset, RDO.rdConcurRowVer)
If rsFin.RowCount > 0 Then
'Opens report
Set rpFin = Crystal.OpenReport(App.Path & "\Test.rpt")
'Defines parameters
rpFin.ParameterFields.Item(1).AddCurrentValue "Title"
'Set DataSoruce
rpFin.Database.SetDataSource rsFin
'Shows report
With CRViewer1
.ReportSource = rpFin
.ViewReport
End With
Else
MsgBox "No record"
End If
End Sub
Private Sub Form_Load()
'Connecting with database
Set cnFin = RDO.rdoEnvironments(0).OpenConnection("", , , _
"DRIVER=SQL Server;SERVER=127.0.0.1;UID=BNP;PWD=password;APP=BNPGest;WSID=NBNIETTO;DATABASE=BNPGEST_DESENV;LANGUAGE=us_english;Network=DBMSSOCN;Address=127.0.0.1,1433")
'Initiating Crystal
Set Crystal = New CRAXDRT.Application
End SubThe same example using ADO works fine, but I have to keep the project with RDO.
I found this article: http://support.businessobjects.com/library/kbase/articles/c2016624.asp?ref=devzone_xiresources_tipsandtricks , But the report yet results no records even using the batchclient. Does anyone can help me?

No comments:

Post a Comment