Changing SQL Database @ Runtime [RESOLVED]
I am sure this is somewhere in the forums but I can't find a definitive answer. I have an app that is using the Crystal Report Viewer to display some reports. I'm hitting a SQL server 2000 Database. My problem is getting these reports to run on a database with a different name.
I sent my App to a friend of mine and the reports won't run. I set up my instance of SQL Server with an Alias and he didn't set his up that way. Also, our databases are named differently. The reports run perfectly on my machine but when he tried to run them he gets "Server has not yet been opened."
I have looked at the knowlege base at Crystal Decisions and have tried some of their suggestions with the reports.
Here's a snippet of my current code.
VB Code:
If crApp Is Nothing Then
Set crApp = New CRAXDRT.Application
Call crApp.LogOnServerEx("p2ssql.dll", DBConn.Server & IIf(LenB(Trim$(DBConn.Alias)) > 0, "\" & DBConn.Alias, ""), _
DBConn.DatabaseName, DBConn.UserName, DBConn.UserPass, Chr(34) & CStr(CRDatabaseType.crSQLDatabase) & Chr(34), DBConn.ConnString)
End If
Load rptForm
Set rpt = crApp.OpenReport(rptPath)
I thought that the LogOnServer and LogonServerEx were supposed to be the way to change data sources. Any help is appreciated. Thanks.
Re: Changing SQL Database @ Runtime [RESOLVED]
I am using the same code but data is still pulling from the original db. Why?