By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,537 Members | 1,743 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,537 IT Pros & Developers. It's quick & easy.

How to connect to foxpro database?

P: n/a
Hi
I develope an application in VB.Net. I want to connect to foxpro database. I use the following code

Tr
Dim cnn As New OleDbConnectio
cnn.ConnectionString = "Provider=VFPOLEDB.1;" +
"Data Source=E:\FoxDB.dbc;
cnn.Open(
Catch e As System.Exceptio
MsgBox(e.Message
End Tr

Although database tables is contained in "E:\FoxDB" folder, the following error message is displayed: Invalid path or file name

Would you help me please

Thanks
Kim
Jul 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Kino,

It is Cindys stuff, however when I see this, than you have set a reference
to something strange
"Data Source=E:\FoxDB.dbc;"


That is in my opinion the FoxDB.dbc database in the mainroot from drive E:\

Should it not be something as
E:\FoxDB\FoxDB.dbc or whathever name that dbc has

However not my stuff but Cindy visits this newsgroup regulary however not
daily.

Cor
Jul 21 '05 #2

P: n/a
On Wed, 12 May 2004 02:21:04 -0700, "Kimo" <an*******@discussions.microsoft.com>
wrote:

Hi,
I develope an application in VB.Net. I want to connect to foxpro database. I use the following code:

Try
Dim cnn As New OleDbConnection
cnn.ConnectionString = "Provider=VFPOLEDB.1;" + _
"Data Source=E:\FoxDB.dbc;"
cnn.Open()
Catch e As System.Exception
MsgBox(e.Message)
End Try

Although database tables is contained in "E:\FoxDB" folder, the following error message is displayed: Invalid path or file name.


The syntax looks OK to me. Is the E: drive a local resource and if not do you
have full access permissions to the network resource? Does the same code work if
the database source is on the C: drive?
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Jul 21 '05 #3

P: n/a
In news: 74**********************************@microsoft.com,
Kimo <an*******@discussions.microsoft.com> wrote:
cnn.ConnectionString = "Provider=VFPOLEDB.1;" + _
"Data Source=E:\FoxDB.dbc;" Although database tables is contained in "E:\FoxDB" folder, the
following error message is displayed: Invalid path or file name.


Hi Kimo,

FoxPro tables can come in either of two formats. They can be "free" tables,
meaning that each table is independent of the others, or they can be part of
a "database container" which holds metadata and allows additional features
for the tables. If you see a file with a DBC extension then you've got a
database.

Here are two connection strings:

*-- Free table directory
Provider=VFPOLEDB.1;Data Source=C:\My Documents\Visual FoxPro
Projects;Password="";Collating Sequence=MACHINE

*-- Database Container
Provider=VFPOLEDB.1;Data Source=C:\My Documents\Visual FoxPro
Projects\Test.DBC;Password="";Collating Sequence=MACHINE
--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci**************@mvps.org www.cindywinegarden.com

Jul 21 '05 #4

P: n/a
If "E:\FoxDB" is the folder shouldn't your data source be
"Data Source=E:\FoxDb\FoxDB.dbc;" ?

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.