Captain Baz

I am using the following connection string :-

Provider=VFPOLEDB.1;Data Source=C:\Baz\TCB\Data\TCB.dbc;

When I have the database and VB programs on the same PC, it works OK.

I want to implement Multi-User capabily now so have to move the database to a different PC on the same LAN (Workgroup).

Despite much experimentation and reading upon the subject, I can't make it work. I always get error 5,"Invalid path or file name" in VFPOLEDB.

I know it is something simple, but I am beaten, can anyone help me


Re: Accessing a VFP Database using VB.Net

Carl Warner

In the connection string that another PC in the workgroup uses it will have to use a different path to get to that same dbc. You must have a share or a mapped drive to be able to get to that dbc from another PC on the network and its connection string must point at that location, not your local drive location.

Re: Accessing a VFP Database using VB.Net

Captain Baz

Thanks for the reply to my query. Unfortunately, it doesn't help!

I have done all of the things you have suggested, but to no avail. By way of example, I have placed a share on the folder that holds the database on the other work-station. I also tried mapping that folder. (I used Z: very original). Nothing changed, I still get exactly the same error. I even went to the extent of mapping the folder on my local work-station to Y: which is shown as being mapped to \\Prog-Dev\Baz (obviously, Prog-Dev is the name of my work-station). This gives an address of :-

Y:\TCB\Data\TCB.dbc. Doing this then results in exactly the same error.

I tried using a third work-station on the network in case there was something 'silly' with the work-station I was using. No change.

It appears to be something to do with the name of the work-station. As soon as the work-station's name is included iin the Connection String (whether directly or via a mapping) it all stops working (even on my local work-station).



Re: Accessing a VFP Database using VB.Net


You can use mapped drives or the more versatile UNC path in the connection string. ie (C# but easy to convert to VB):

Code Block

using System;
using System.Data;
using System.Data.OleDb;

class sample
static void Main()
OleDbConnection con = new OleDbConnection(@"Provider=VFPOLEDB;

Data Source=\\myserver\myShare\myFolder\testdata.dbc");
OleDbCommand cmd = new OleDbCommand("select * from customer",con);
OleDbDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
Console.WriteLine("{0} {1}",

However in a LAN or WAN environment it's important that you have necessary rights to that location. You say that it's VB.Net but don't say what kind of application. Probably you're trying with ASP.Net where default user context is ASPNET or Network service. Whoever it's trying to access to the resource, should have the rights. You may add trusts, use impersonation etc as described in .Net help. IOW it's not a matter of VFPOLEDB driver. You may try reading/writing to a simple txt file in that folder.

Re: Accessing a VFP Database using VB.Net

Captain Baz

Firstly, thank you for taking the time to help me with this problem of mine!

Some background :-

I am working with a LAN (3 PCs connected together as a Workgroup all running XP Home Edition).

I have mapped the shares.

I am able to easily navigate to the share that I have my remote database on via 'My Computer'. Having navigated to the share (both directly and using it's mapped name) across the LAN, I can add, edit and delete files with no problems whatsoever. (I can also edit and delete the database files).

In short, everything is working perfectly!

The connection string I am using on my local PC works OK! It is when I try and incorporate the name of any of the PCs on my network into the connection string - including the one I am working on (the local one) - that I have trouble. I then get this error :-

Error No : 5.

Description : Invalid Path or File Name

Module Name : Microsoft OLE DB Provider for Visual FoxPro

In the interests of making this perfectly clear :-

My PC's name is "Prog-Dev". No share name, but "C:\Baz" is mapped to "Y:".

The PC I am trying to access the remote Database on is "InetSvr". The share name on this PC is "Baz" on drive C: which is mapped to "Z:"

The only Connection String that works is - "Provider=VFPOLEDB.1;Data Source=C:\Baz\TCB\Data\TCB.dbc;"

If I try and make any reference whatsoever to a Server name on either PC, it doesn't work. I get the aforementioned error.

For example, none of the following work :-





In summary, it is only when I mention the Server name either directly or implicitly that I am in trouble. It doesn't appear to be anything to do with rights, privaleges, permissions etc, etc on my LAN as it doesn't work on my local computer either.

(Am I missing any references or name-spaces in my VB I have imported the name-spaces you gave on your example, but is there more ) Just a thought.



Re: Accessing a VFP Database using VB.Net


Probably I was not clear enough. Do not check using windows explorer but your .Net code. Try listing, reading and writing text files to those remote locations from within your .Net code. ie:

Imports System

Imports System.IO

public class testRemotePath

shared Sub Main()

dim sw as TextWriter

sw = new StreamWriter("\\InetSvr\Baz\TCB\Data\WriteTest.txt")

sw.Write("Hello. Yes you can write to this path.")


end sub

End class

Your path expression seems to be wrong. If this works replace your connection string with coorect path.