Solved

Ho to Create a dBase DSN in Visual Basic?

Posted on 1999-01-20
6
755 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
[Unsupported] SQL Update in CRM 2011 Database 19 65
Microsoft Access VBA - allocate a colour 3 74
Deny sending to more than 2 recipients in Exchange 2016 2 49
T-sql question 13 32
As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Read about achieving the basic levels of HRIS security in the workplace.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

738 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