Rohan_Powle
Feb 19th, 2003, 11:07 PM
Initially I have developed the rpt using Exports DB but want to change it to Exports1. I am using Vb6, Sql Server 7 & CR8 with RDC.
I Tried the below code but was not opening Exports1 DB but showing Exports DB's data :(. But When I added this line of code (Report.SQLQueryString = "Select * From Customer") as there is only 1 table in the dummy report,
Between code Report.DiscardSavedData and Report.Database.LogOnServer the report is displayed with Exports1 DB. I am getting what I want but do I have to write the SQLQueryString for all the reports I want to change the Database? Pls let me know a feasible solution..
When I Unload the Form which has (Report.SQLQueryString = "Select * From Customer") code. VB terminates itself. One more disaster for in the way.
Pls Help me out :(
Private Sub Form_Load()
' Declare a DatabaseTable Object
Dim crxDatabaseTable As CRAXDRT.DatabaseTable
' Declare a Report object to set to the subeport
Dim crxSubreport As CRAXDRT.Report
' Open the report
Set Report = crxApplication.OpenReport("f:\rdc\cust.rpt", 1)
Report.DiscardSavedData
Report.Database.LogOnServer "pdssql.dll", "Rohan", "Exports1", "sa"
'Use a For Each loop to change the location of each
'DatabaseTable in the Reports DatabaseTable Collection
For Each crxDatabaseTable In Report.Database.Tables
crxDatabaseTable.SetLogOnInfo "Rohan", "Exports1", "sa"
Next crxDatabaseTable
End Sub
I Tried the below code but was not opening Exports1 DB but showing Exports DB's data :(. But When I added this line of code (Report.SQLQueryString = "Select * From Customer") as there is only 1 table in the dummy report,
Between code Report.DiscardSavedData and Report.Database.LogOnServer the report is displayed with Exports1 DB. I am getting what I want but do I have to write the SQLQueryString for all the reports I want to change the Database? Pls let me know a feasible solution..
When I Unload the Form which has (Report.SQLQueryString = "Select * From Customer") code. VB terminates itself. One more disaster for in the way.
Pls Help me out :(
Private Sub Form_Load()
' Declare a DatabaseTable Object
Dim crxDatabaseTable As CRAXDRT.DatabaseTable
' Declare a Report object to set to the subeport
Dim crxSubreport As CRAXDRT.Report
' Open the report
Set Report = crxApplication.OpenReport("f:\rdc\cust.rpt", 1)
Report.DiscardSavedData
Report.Database.LogOnServer "pdssql.dll", "Rohan", "Exports1", "sa"
'Use a For Each loop to change the location of each
'DatabaseTable in the Reports DatabaseTable Collection
For Each crxDatabaseTable In Report.Database.Tables
crxDatabaseTable.SetLogOnInfo "Rohan", "Exports1", "sa"
Next crxDatabaseTable
End Sub