Solved

Ho to Create a dBase DSN in Visual Basic?

Posted on 1999-01-20
6
702 Views
Last Modified: 2013-11-24
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,strDriver, 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.

0
Comment
Question by:kolobok
  • 3
  • 2
6 Comments
 

Author Comment

by:kolobok
ID: 1026313
Edited text of question
0
 

Author Comment

by:kolobok
ID: 1026314
Adjusted points to 100
0
 
LVL 1

Expert Comment

by:Seeker092397
ID: 1026315
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.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 4

Accepted Solution

by:
arcusd earned 100 total points
ID: 1026316
'try this code

 strAttribs = "Description=" + "  DataSource" _
          + Chr$(13) + "DBQ=" + "Test.dbf"

   rdoEngine.rdoRegisterDataSource App.Title, _
               "Microsoft dBase Driver (*.dbf)", True, strAttribs

0
 
LVL 4

Expert Comment

by:arcusd
ID: 1026317
App.Title will be the DSN

strAttribs = "Description=" + "  DataSource" _
             + Chr$(13) + "DBQ=" + "Test.dbf"

rdoEngine.rdoRegisterDataSource "TEST", _
                  "Microsoft dBase Driver (*.dbf)", True, strAttribs
0
 

Author Comment

by:kolobok
ID: 1026318
ODBC_REMOVE_DSN was just mistyping. I used ODBC_ADD_DSN.
But anyway I was sujjested using different function
SQLConfigDataSource(vbAPINull, 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(vbAPINull, ODBC_ADD_DSN, strDriver, strAttributes)

Thank you for your help
 
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now