|
|
Question : Connecting to a db programmatically via File DSN using Visual Basic
|
|
Hi I have a problem connecting to a Lotus notes database via FILE DSN.
What I did: created in odbc datasource administrator , dsn file with the server name, database name and user id and password. I manually linked the file in Access and it worked.. what I need: I need to automatically link the table using Visual basic, so I wrote: tdf.Connect = "ODBC;FILEDSN=" & DBName & ";UID=" & Name & ";PWD=" & PASSWORD & ";LANGUAGE=us_english;"
tdf.SourceTableName = TblToImport dbs.TableDefs.Append tdf
when it runs the last line, I got an error message: [lotus][odbc lotus notes]driver not capable then the window of the file dsn configuration appears, the server and the database fields are reset! But the username and the password are still present, if I complete the server and database fields manually and press OK, it works
why do I need to do this? How comes it works manually and loose a part of the dsn parameters when I try to run programmatically?
Your answers will be very helpful, Thanks!
|
Answer : Connecting to a db programmatically via File DSN using Visual Basic
|
|
>>>> As i tested by replacing: >>>> "ODBC;FileDSN=" & ODBCPATH & DBName & ".DSN" & ";UID=" & Name & ";PWD=" & PASSWORD >>>> & ";LANGUAGE=us_english;" >>>> >>>> with >>>> "ODBC;FILEDSN=C:\ContractDb.DSN;UID=JP.Luc;PWD=pass;LANGUAGE=us_english;"
Did that change connect properly?
I have tried it here, but I do not have a Lotus db with which to perform the test. I used an Access file DSN, which then reports back this error when it hit the .Append line:
"You cannot use ODBC to import from, export to, or link an external Microsoft Jet or ISAM database table to your database. (Error 3423)"
It does, however, manage to connect to the database using the string concatenation after I set the strings to the proper items.
|
|
|
|
|