Refering to knowledge base resources ( I'm trying
to set location to an ODBC File DSN at run-time.
I'm working on this contest:
1. the DSN file is a valid DSN file
2. using MS VisualBasic I can successfully logon to the database using the same DSN file (see code listed below)
3. the Crystal Reports TestConnectivity method return False
4. running the report I get "server has not yet been opened" error message
Do I have to specify any prefix before the DSN file name? How can I trace the CR logon error?
Thanks in advance,
Luca ALBERTI
luca.alberti@ramcube.it
------------------------------------------------
Changing CR database location at run-time
------------------------------------------------
Private Sub Report_Initialize()
Dim objTemp As CRAXDDRT.DatabaseTable
'Get old config
For Each objTemp In Me.Database.Tables
MsgBox objTemp.LogOnServerName
Next
'Set new config
Me.Database.Tables.Item(1).SetLogOnInfo "c:\temp\Test.dsn", "profaCHIM", "sa", ""
'Test new config
Me.Database.Tables.Item(1).TestConnectivity
End Sub
------------------------------------------------
Testing DSN connection from MS Visual Basic
------------------------------------------------
Dim cn As New rdoConnection
Dim qd As New rdoQuery
cn.Connect = "FILEDSN=c:\temp\Test.dsn;"
cn.CursorDriver = rdUseOdbc
cn.EstablishConnection rdDriverNoPrompt
Debug.Print cn.Connect
to set location to an ODBC File DSN at run-time.
I'm working on this contest:
1. the DSN file is a valid DSN file
2. using MS VisualBasic I can successfully logon to the database using the same DSN file (see code listed below)
3. the Crystal Reports TestConnectivity method return False
4. running the report I get "server has not yet been opened" error message
Do I have to specify any prefix before the DSN file name? How can I trace the CR logon error?
Thanks in advance,
Luca ALBERTI
luca.alberti@ramcube.it
------------------------------------------------
Changing CR database location at run-time
------------------------------------------------
Private Sub Report_Initialize()
Dim objTemp As CRAXDDRT.DatabaseTable
'Get old config
For Each objTemp In Me.Database.Tables
MsgBox objTemp.LogOnServerName
Next
'Set new config
Me.Database.Tables.Item(1).SetLogOnInfo "c:\temp\Test.dsn", "profaCHIM", "sa", ""
'Test new config
Me.Database.Tables.Item(1).TestConnectivity
End Sub
------------------------------------------------
Testing DSN connection from MS Visual Basic
------------------------------------------------
Dim cn As New rdoConnection
Dim qd As New rdoQuery
cn.Connect = "FILEDSN=c:\temp\Test.dsn;"
cn.CursorDriver = rdUseOdbc
cn.EstablishConnection rdDriverNoPrompt
Debug.Print cn.Connect