Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to change datasource at runtime. CR9.
Message
From
19/07/2006 17:40:20
 
 
To
30/06/2006 11:38:25
General information
Forum:
Visual FoxPro
Category:
Crystal Reports
Miscellaneous
Thread ID:
01132957
Message ID:
01137845
Views:
18
Hello Craig. After testing different options, our scenario worked this way:

Since the data source is a stored procedure, something wasn't working until we cleared the DBTable.SetTableLocation values.

Thanks,
LOCAL loCR as CRAXDRT.Application
LOCAL loRpt as CRAXDRT.Report

loCR= CREATEOBJECT( "CrystalRuntime.Application")

loRpt= loCR.OpenReport( "Any_report.rpt" )
lorpt.EnableParameterPrompting = .F.

LOCAL oCProps as CRAXDRT.ConnectionProperties
LOCAL DBTable As CRAXDRT.DatabaseTable


lnTables = loRpt.Database.Tables.Count
FOR h = 1 TO lnTables
	DBTable = loRpt.Database.Tables(h)
	oCProps = loRpt.Database.Tables(h).ConnectionProperties
	oCProps.DeleteAll
	oCProps.Add("FILEDSN",THISFORM.report_dsn) && Our runtime value

	&& Our missing statement to clear more design time settings
	DBTable.SetTableLocation ("", DBTable.Location, "")  

NEXT h
Thanks,
Juan C.



>I don't know if it will make a difference when you DiscardSavedData(). I've never tested it.
>
>>Yes , we do it. But I have noticed something. We do it after assigning the FileDSN at runtime. Should it be before?
>>
>>
>>We also disable the "File - save data with report" option during design.
>>
>>Thanks.
>>
>>
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform