Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Refreshing the data in Crystal Reports from a ADO record
Message
 
 
To
22/05/2002 10:42:45
General information
Forum:
Visual FoxPro
Category:
Crystal Reports
Miscellaneous
Thread ID:
00659912
Message ID:
00660436
Views:
9
Tornquist,

I had the same problem.
The connection had to be cut.

*-- 01/05/2002 Bug !!
*-- Si la connection n'est pas coupée CR garde les anciennes data.
oCursor.oRecordset.Activeconnection = .NULL.



PROTECTED FUNCTION REQUERY()

LOCAL lnCursor AS INTEGER
LOCAL oSubReport AS OBJECT
LOCAL rptObject AS OBJECT
LOCAL Sect AS OBJECT
LOCAL dbtable AS OBJECT
LOCAL oRecordset AS OBJECT
LOCAL oCursor AS OBJECT


WITH THIS
.BeforeRequery()

FOR lnCursor = 1 TO ALEN( .aCursors , 1)
*!* oCursor = EVAL( ".o" + .aCursors[ lnCursor ] )
oCursor = .aCursors[ lnCursor ]
*-----------------------------------------------------------------
*-- Il y a peut être des vues ou des tables que l'on ne veut pas
*-- importer ds crystalreport.
IF VART( oCursor ) == "O" AND oCursor.l_cr_Put_In_Ado_cursor = .T.
*---------------------------------------------------------------

*-- Si c'est pour un rapport( à l'inverse d'un subrapport ).
*!* oRecordset = oCursor.oRecordset
IF EMPTY( oCursor.cCrystalSubReportName )
*------------------------------------------------------------
*---- ATTENTION
ocrReport.DATABASE.setDataSource( oCursor.oRecordset , 3 , lnCursor )

ELSE && *-- Si c'est pour un subreport...
*-- Passons toutes les sections
FOR EACH Sect IN ocrReport.sections
*-- Passons tous les objets.( crSubreportObject , crCrossObjects etc...
FOR EACH rptObject IN Sect.ReportObjects
*----------------------------------------------------------------------
*-- Si c'est un sous rapport.
IF rptObject.kind = 5 && crSubreportObject crSubReportObject ...
*-- ouvrir le sous rapport comme un rapport.
oSubReport = rptObject.OpenSubreport()
* WAIT WINDOW oSubReport.Name
*-- Passons toutes les tables ou curseur.
FOR EACH dbtable IN oSubReport.DATABASE.TABLES
*-- Il faut que la table ou le cursor ADO
*-- ait le même nom que oCursor.cCrystalSubReportName.
*-- autrement dit il faut bien synchroniser les propriétées.
*WAIT WINDOW dbtable.NAME
IF UPPER( ALLTR( dbtable.NAME )) = UPPER( ALLTR( oCursor.cCrystalSubReportName ))
dbtable.setDataSource( oCursor.oRecordset , 3 )
EXIT
ENDIF
NEXT

ENDIF
NEXT
NEXT
ENDIF

*-- 01/05/2002 Bug !!
*-- Si la connection n'est pas coupée CR garde les anciennes data.
oCursor.oRecordset.Activeconnection = .NULL.

ENDIF
.aCursors[ lnCursor ] = .NULL.
ENDFOR




*-- ATTENTION
ocrReport.readRecords()
.AfterRequery()

ENDWITH
Previous
Reply
Map
View

Click here to load this message in the networking platform