Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the location of a ODBC file DSN at runtime

Status
Not open for further replies.

lalberti

Programmer
Nov 14, 2000
100
IT
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
 
I think u have to set the location of the tables after setting the log info..

Hope this helps..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top