Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to run report on different database name
Message
De
20/06/2006 19:13:07
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Crystal Reports
Titre:
How to run report on different database name
Divers
Thread ID:
01130382
Message ID:
01130382
Vues:
90
Hello ,

We have been running our reports on 2 differente servers, say 'test_server' and 'prod_server'. In both cases the original database was named 'QNECT'.

We used to re-define a DSN property during run-time in order to specify a different DSN file which indicates the server and database to connect to. We do it this way:
loCR= CREATEOBJECT( "CrystalRuntime.Application")
loRpt= loCR.OpenReport( lcPathReport )

LOCAL oCProps as CRAXDRT.ConnectionProperties

lnTables = loRpt.Database.Tables.Count
FOR h = 1 TO lnTables
	oCProps = loRpt.Database.Tables(h).ConnectionProperties
	oCProps.DeleteAll
	oCProps.Add("DSN",THISFORM.report_dsn)
NEXT h

IF loRpt.HasSavedData
	loRpt.DiscardSavedData()
ENDIF

Thisform.oleCRViewer.ReportSource= loRpt
thisform.oleCRViewer.refreshEx

Thisform.oleCRViewer.ViewReport()
But we have created a new database named QNECT_TEST and Crystal reports keep searching for the original database name and displaying an error like this:

Crystal report viewer:
failed to open a rowset.
Details: 08004 SQL Native client. Could not locate entry in sysdatabases for database 'QNECT'. No entry found with that name. Make sure that the name is entered correctly

Of course the DSN file already keeps a reference to the new database name, but Crystal is not 'seeing' this value?

How can we tell Crystal to use my parameters from the DSN file and use a differente database name at runtime? It's accepting a different server, but not a different database name, no matter structures are the same.


Thanks.


Juan C.
Répondre
Fil
Voir

Click here to load this message in the networking platform