473,383 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Opening a dbf File

Hi,

I'm having some trouble opening a dbf file in my application. I'm
getting an oledb exception with the error message:

Message @"'C:\Work\comp310.dbf' is not a valid path. Make sure that
the path name is spelled correctly and that you are connected to the
server on which the file resides."

It is a valid path as the variable to the dbf is filled from an
openfile dialog. Here's the relevant code (pathName is
"C:\Work\comp310.dbf" in this case):

string dbfConnString = String.Format
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended
Properties=dBase IV", pathName);

oleDA = new OleDbDataAdapter("Select * From myDBF", dbfConnString);

OpenDBF("myDBF");

private DataSet OpenDBF(string tableName)
{
oleDA.Fill(myDS, tableName);
return myDS;
}

Thanks in advance for any advice

Apr 25 '06 #1
1 2667
Hi!

Please do yourself a favor and use the FoxPro and Visual FoxPro OLE DB data
provider, downloadable from msdn.microsoft.com/vfoxpro/downloads/updates.

Since you're using a "free" table your connection string should point to the
directory where the DBFs reside, not to a particular file name. The simplest
form of connection string looks like "Provider=VFPOLEDB.1;Data
Source=C:\Temp\;" .

Point to the specific table in your Select statement as you've done below.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci**************@msn.com www.cindywinegarden.com
"Ctal" <wi********@yahoo.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
Message @"'C:\Work\comp310.dbf' is not a valid path. ... (pathName is
"C:\Work\comp310.dbf" in this case):

string dbfConnString = String.Format
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended
Properties=dBase IV", pathName);

oleDA = new OleDbDataAdapter("Select * From myDBF", dbfConnString);

Apr 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: PM | last post by:
Has anyone found a way to open a file exclusively where it will fail if the file is already open, i have tried the following _FileStream = new FileStream(@"C:\Data.txt", FileMode.Open,...
1
by: Alfons | last post by:
Hello, I have build a program that can do file transferring between a Windows XP computer and a DOS computer via a serial port. The Windows program I have build in C++ with Visual Studio 6.0....
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
5
by: Brad | last post by:
In several aspx applications I export crytal reports to pdf, xls and doc files and then the aspx page writes the selected export file to the client browser. This all works with one small quirk: ...
11
by: aldrin | last post by:
I'm trying to run this code under windows xp sp2 using codeblocks v1.0 compiler with great difficulty.There is no problem with running this under KDevelop in linux. Any help would be greatly...
2
by: Craig | last post by:
Hi there, I'm trying to open colour BMPs using PIL and I'm getting the following errors. Opening a 16 colour BMP I get: Traceback (most recent call last): File "<pyshell#3>", line 1, in...
9
compman9902
by: compman9902 | last post by:
Hello, and thank toy for reading this post. Thus far, this website has helped me a lot, (I have finally finished my encryptor: "site removed by moderator", go to the downloads link) and I will...
15
by: Umesh | last post by:
how to open a website like yahoo.com and use it as input? The following code doesn't work. #include"stdio.h" int main() { FILE *f; f=fopen("http://www.yahoo.com","r"); if(f==NULL)
1
by: Sanjeeva K kanakam | last post by:
Hi all, I am developing one application. In that i have created on report file which contains tables, titles and tree view list also by using HTML tags. I am opening this file in my application it...
34
by: Alexnb | last post by:
Gerhard Häring wrote: No, it didn't work, but it gave me some interesting feedback when I ran it in the shell. Heres what it told me: Traceback (most recent call last): File...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.