The following is some code provided to me from Crystal
Reports that may help:
Sub SetReportFileLocations(ByRef rpt As ReportDocument)
Dim crConnectionInfo As New ConnectionInfo
With crConnectionInfo
'physical server name (OLE DB) or ODBC DSN
.ServerName = DNSName
' Note: you do not need to set .DatabaseName for
Oracle.
.DatabaseName = DatabaseName
.UserID = LogonUserName
.Password = LogonUserPassword
End With
'Get the table information from the report
Dim crDatabase As Database
crDatabase = rpt.Database
Dim crTables As Tables
crTables = crDatabase.Tables
Dim crtable As Table
'Loop through all tables in the report and apply the
connection
'information for each table.
Dim crTableLogOnInfo As TableLogOnInfo
For Each crtable In crTables
crTableLogOnInfo = crtable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crtable.ApplyLogOnInfo(crTableLogOnInfo)
If crtable.TestConnectivity() Then
' Create fully qualified name by
appending "database.owner." to the table name.
crtable.Location = DatabaseName & ".dbo." +
crtable.Location.Substring(crtable.Location.LastIn dexOf
(".") + 1)
Else
MessageBox.Show("Connection Failed attempting to
connect to table: " & DatabaseName & ".dbo." +
crtable.Location.Substring(crtable.Location.LastIn dexOf
(".") + 1))
End If
Next
End Sub
-Lee
-----Original Message-----
I have a bunch of reports in crystal reports.net, i need
to basicly run themon differnt databases depending on which one the user
logged into at thevb.net application start (dev, live, testing)... now the
reports are createdat the development level.. so i figured just change the
database like youpass parameters to the report viewer... well.. I cant
seem to figure thatone out, but the report alone as an object
(ReportDocument object) has amethod SetDataSource which lets you specify the
user,pass,database,servername per report... now my questions are
1) instead of at the report level can i do this at the
report viewer levelsomehow?
2) how do i use windows authentication with this? it
seems to supportuser/pass only.. thanks
.