kolobok
asked on
Ho to Create a dBase DSN in Visual Basic?
I was using Q171146 at http://www.codeguru.com/vb/links/jump.cgi?ID=347 as an example creating my dBase DNS. I set a driver to
strDriver = "Microsoft dBase Driver (*.dbf)",
provided attrributes and hWnd as a parameters for the API function from ODBCJT32.DLL:
intRet = ConfigDSN(hWnd,ODBC_REMOVE _DSN,strDr iver, strAttributes)
I was surprized when instead of "ODBC dBase Setup" dialog "ODBC Microsoft Access 97 Setup" dialog appeared. I tried to set it to a different drivers but it alvays displayed "ODBC Microsoft Access 97 Setup" dialog. What wrong did I do? Maybe I set wrong attributes? What are the attributes for dBase driver anyway, where to fing them?
An example would be appreciated very much.
strDriver = "Microsoft dBase Driver (*.dbf)",
provided attrributes and hWnd as a parameters for the API function from ODBCJT32.DLL:
intRet = ConfigDSN(hWnd,ODBC_REMOVE
I was surprized when instead of "ODBC dBase Setup" dialog "ODBC Microsoft Access 97 Setup" dialog appeared. I tried to set it to a different drivers but it alvays displayed "ODBC Microsoft Access 97 Setup" dialog. What wrong did I do? Maybe I set wrong attributes? What are the attributes for dBase driver anyway, where to fing them?
An example would be appreciated very much.
ASKER
Adjusted points to 100
Unless you want to remove an existing DSN you should't use ODBC_REMOVE_DSN. As i understand you want to create a new DSN so specify ODBC_ADD_DSN instead.
Hope it helps.
Best regards.
Hope it helps.
Best regards.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
App.Title will be the DSN
strAttribs = "Description=" + " DataSource" _
+ Chr$(13) + "DBQ=" + "Test.dbf"
rdoEngine.rdoRegisterDataS ource "TEST", _
"Microsoft dBase Driver (*.dbf)", True, strAttribs
strAttribs = "Description=" + " DataSource" _
+ Chr$(13) + "DBQ=" + "Test.dbf"
rdoEngine.rdoRegisterDataS
"Microsoft dBase Driver (*.dbf)", True, strAttribs
ASKER
ODBC_REMOVE_DSN was just mistyping. I used ODBC_ADD_DSN.
But anyway I was sujjested using different function
SQLConfigDataSource(vbAPIN ull, ODBC_ADD_DSN, strDriver, strAttributes) and it worked perfectly with the same attributes and parameters.
strDriver = "Microsoft dBase Driver (*.dbf)"
'Set the attributes delimited by null.
strAttributes = "DSN=" & strDSN & Chr$(0)
strAttributes = strAttributes & "DefaultDir=" & strDefDir & Chr$(0)
strAttributes = strAttributes & "DESCRIPTION=" & strDescr & Chr$(0)
intRet = SQLConfigDataSource(vbAPIN ull, ODBC_ADD_DSN, strDriver, strAttributes)
Thank you for your help
But anyway I was sujjested using different function
SQLConfigDataSource(vbAPIN
strDriver = "Microsoft dBase Driver (*.dbf)"
'Set the attributes delimited by null.
strAttributes = "DSN=" & strDSN & Chr$(0)
strAttributes = strAttributes & "DefaultDir=" & strDefDir & Chr$(0)
strAttributes = strAttributes & "DESCRIPTION=" & strDescr & Chr$(0)
intRet = SQLConfigDataSource(vbAPIN
Thank you for your help
ASKER