Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crystal Reports - Passing Parameters to
Message
From
02/05/2005 14:42:09
 
 
To
02/05/2005 14:34:24
General information
Forum:
Visual FoxPro
Category:
Crystal Reports
Miscellaneous
Thread ID:
01010203
Message ID:
01010265
Views:
19
I'll play with this a bit

thanks

>Here's an example on how to login to the SQL database. It doesn't matter if the app is already logged in, the report object needs to set every table used in the report to the correct SQL login info. Any questions on this, let me know.
>
>
PROCEDURE LogOnSQL
>This.FixUpTables()
>* look for subreports, update SQL Server logon info
>		FOR EACH loSection IN This.oReport.Sections
>			WITH loSection
>				FOR EACH loReportObject IN .ReportObjects
>					IF loReportObject.Kind = crSubreportObject
>						loSubreport = This.oReport.OpenSubreport(loReportObject.SubreportName)
>
>						WITH loSubreport
>							STORE .F. TO .MorePrintEngineErrorMessages, .EnableParameterPrompting
>						ENDWITH
>
>						This.FixUpTables(loSubreport, lcSQLServer, lcDBName, lcUserID, lcPswd)
>
>						loSubreport = .null.
>					ENDIF
>				NEXT loReportObject
>				loReportObjects = .null.
>			ENDWITH
>		NEXT loSection
>ENDPROC
>
>******************************************	
>	PROCEDURE FixUpTables
>	******************************************		
>
>		LPARAMETER toReport, tcSQLServer, tcDBName, tcUserID, tcPswd
>
>		LOCAL loTable, lcLocation, lcUserID, lcPswd, sConnString
>
>		FOR EACH loTable IN toReport.Database.Tables
>					>			WITH loTable
>				lcLocation = .Location
>					*** connect to SQL Server using OLEDB (ConnectionProperties)		
>					loConnProps = loTable.ConnectionProperties
>					*** delete all existing connection properties
>					loConnProps.DeleteAll()
>					*** add new connection properties
>					loConnProps.Add("Provider","SQLOLEDB")
>		>					loConnProps.Add("Data Source",tcSQLServer)
>					loConnProps.Add("Initial Catalog",tcDBName)
>
>					loConnProps.Add("User ID",tcUserID)
>					>					** check for dbl quote - change to chr(34)
>					tcPswd = ScrubDblQuote(tcPswd)
>					>					loConnProps.Add("Password", tcPswd)
>					IF "Proc(" $ lcLocation
>						lcLocation = STRTRAN(lcLocation,"Proc(","")
>						lcLocation = STRTRAN(lcLocation,")","")
>					ENDIF
>					.Location = tcDBName + ".dbo." + lcLocation
>				>			ENDWITH
>		NEXT loTable
>		>		loTable = .null.
>ENDPROC
Previous
Reply
Map
View

Click here to load this message in the networking platform