ChubbyArse
Programmer
Hi,
I'm having problems which may relate to my issue which I've posted earlier.
I am using global variables to change a report's data connection at runtime,
so that I don't need to have development and client copies of reports.
Seems a simple enough requirement?
The reports data, is from a single SQL Server stored procedure.
I am calling the report from a VB6 application, and the report is going
directly to the printer.
I am using Crystal Reports 9.
Here is the code I am using to change the properties:
***Code Start***
Set CRApp = New CRAXDDRT.Application
Set CRFax = CRApp.OpenReport(m_strFaxSheetPath)
Set CRTable = CRFax.Database.Tables(1)
CRFax.DiscardSavedData
CRTable.ConnectionProperties.Item("Provider"
= "SQLOLEDB"
CRTable.ConnectionProperties.Item("Data Source"
= m_strSQLServerName
CRTable.ConnectionProperties.Item("Initial Catalog"
=
m_strSQLDatabaseName
CRTable.ConnectionProperties.Item("User ID"
= m_strSQLUserID
CRTable.ConnectionProperties.Item("Password"
= ""
CRTable.Location = m_strSQLDatabaseName & ".dbo.proc_Get_FaxDetail"
CRFax.ParameterFields.GetItemByName("@ServiceRequestID"
.AddCurrentValue
lngServiceRequestID
***Code End***
When I set the CRTable.Location however, the reports parameters are wiped
out, gone!
If I check the CRFax.ParameterFields.Count it has changed from 1 to nil.
How can I change the database of a report at runtime that has parameters???
If this is not possible, how do I base a report on a ADO recordset??
This would the easier method as I could generate the recordset and just pass
it to the report.....?
Thanks
Alex Stevens
I'm having problems which may relate to my issue which I've posted earlier.
I am using global variables to change a report's data connection at runtime,
so that I don't need to have development and client copies of reports.
Seems a simple enough requirement?
The reports data, is from a single SQL Server stored procedure.
I am calling the report from a VB6 application, and the report is going
directly to the printer.
I am using Crystal Reports 9.
Here is the code I am using to change the properties:
***Code Start***
Set CRApp = New CRAXDDRT.Application
Set CRFax = CRApp.OpenReport(m_strFaxSheetPath)
Set CRTable = CRFax.Database.Tables(1)
CRFax.DiscardSavedData
CRTable.ConnectionProperties.Item("Provider"
CRTable.ConnectionProperties.Item("Data Source"
CRTable.ConnectionProperties.Item("Initial Catalog"
m_strSQLDatabaseName
CRTable.ConnectionProperties.Item("User ID"
CRTable.ConnectionProperties.Item("Password"
CRTable.Location = m_strSQLDatabaseName & ".dbo.proc_Get_FaxDetail"
CRFax.ParameterFields.GetItemByName("@ServiceRequestID"
lngServiceRequestID
***Code End***
When I set the CRTable.Location however, the reports parameters are wiped
out, gone!
If I check the CRFax.ParameterFields.Count it has changed from 1 to nil.
How can I change the database of a report at runtime that has parameters???
If this is not possible, how do I base a report on a ADO recordset??
This would the easier method as I could generate the recordset and just pass
it to the report.....?
Thanks
Alex Stevens