Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

cannot open Visual Fox Pro database

cannot open Visual Fox Pro database

cannot open Visual Fox Pro database

I have to integrate an older COM library with an ASP.NET application. The library loads Fox Pro DBF files into a MSSQL database. The call to the library's main method results in the following error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified. The library works fine with the old ASP site and also works fine when called from a .Net console application.
I presumed that the error was due to insufficient rights of the ASPNET user account and I tried to impersonate my current user account which is member of the Administrator group (the old ASP application uses Windows Authentication). It didn't work, neither with impersonation at web.config level, nor with impersonation at page level using the Win 32 LogonUser method.
I tested the library using vbs scripts and the runas command line utility and I got the following results:
1.    The piece of code causing the trouble is (the error is thrown when the connection opens):
Dim sConnString
sConnString = "DSN=Visual FoxPro Tables;" & _
                  "SourceDB=C:\Temp;" & _
                  "SourceType=DBF;" & _
Set oConnDBF = CreateObject("ADODB.Connection")
oConnDBF.Open sConnString
2.    The code works only under my current user account (it does not work even under the Administrator account)
3.    The code works fine for any user when I use the /noprofile argument of the runas utility
From that I deduct that the error is not due to missing security permissions, but to the Windows profile of the user under which the code executes (that explains why impersonation doesn't work). Maybe this has something to do with the fact that the Visual Fox Pro ODBC driver has been discontinued since MDAC version 2.6. I have installed MDAC 2.6 over MDAC 2.8 because the library explicitly required this version. The installation was carried out under my account and maybe the driver seems to be not installed for the other accounts.

Thanks for any advice

RE: cannot open Visual Fox Pro database

Problem solved,

Stupid me, because the library documentation said nothing about creating a data source, I presumed the connection string was DSN-less and I didn't even look at it.
The "Visual FoxPro Tables"  and "Visual FoxPro Database" DSN's were automatically created, perhaps upon VS 98 installation. I have 2 computers on which they are created as User DSN and one on which are they are created as both user and system DSN's.
I've created identical system DSN's and now everything works.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close