Hi all.

I'm trying to open a dbf file which appears to be FoxPro. I've tried using
the OLE and ODBC classes but I'm not having any luck.

I keep getting an exception: "The Microsoft Jet database engine could not
find the object 'EQR_TRANSACTION_200803'. Make sure the object exists and
that you spell its name and the path name correctly."

Here is the ODBC code:
try

{

string connString = @"DBQ=C:\Test;Driver={Microsoft dBase Driver (*.dbf)};
DriverId=277";


OdbcConnection conn = new OdbcConnection(connString);

OdbcDataAdapter da = new OdbcDataAdapter("select * from
EQR_TRANSACTION_200803", conn);

DataTable table = new DataTable("table");

da.Fill(table);

dataGridView1.DataSource = table;

}

catch (Exception e)

{

MessageBox.Show(e.Message);

}



Any ideas?



Thanks,

Joe

Re: Read a Visual FoxPro dbf file. by Jim

Jim
Wed Jul 02 13:32:13 CDT 2008

Download VfpOleDB.dll



"Joe" <jbassking@noemail.noemail> wrote in message
news:%23mtyRsG3IHA.1420@TK2MSFTNGP06.phx.gbl...
> Hi all.
>
> I'm trying to open a dbf file which appears to be FoxPro. I've tried using
> the OLE and ODBC classes but I'm not having any luck.
>
> I keep getting an exception: "The Microsoft Jet database engine could not
> find the object 'EQR_TRANSACTION_200803'. Make sure the object exists and
> that you spell its name and the path name correctly."
>
> Here is the ODBC code:
> try
>
> {
>
> string connString = @"DBQ=C:\Test;Driver={Microsoft dBase Driver (*.dbf)};
> DriverId=277";
>
>
> OdbcConnection conn = new OdbcConnection(connString);
>
> OdbcDataAdapter da = new OdbcDataAdapter("select * from
> EQR_TRANSACTION_200803", conn);
>
> DataTable table = new DataTable("table");
>
> da.Fill(table);
>
> dataGridView1.DataSource = table;
>
> }
>
> catch (Exception e)
>
> {
>
> MessageBox.Show(e.Message);
>
> }
>
>
>
> Any ideas?
>
>
>
> Thanks,
>
> Joe
>
>



Re: Read a Visual FoxPro dbf file. by Jialiang

Jialiang
Thu Jul 03 03:22:20 CDT 2008

Hello

I know some known scenarios where dBase Driver does not co-operate with
Foxpro well. We generally suggest customers using OLE DB Provider for Visual
FoxPro:
http://www.microsoft.com/downloads/details.aspx?familyid=e1a87d8f-2d58-491f-a0fa-95a3289c5fd4&displaylang=en

The sample connection strings based on Microsoft Visual FoxPro Driver can be
found at:
http://www.connectionstrings.com/?carrier=visualfoxpro

Bill, would you please try the Foxpro driver instead? If you have any
concerns about, please DON¡¯T hesitate to tell me.

Regards,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

"Jim Rand" <jimrand@ix.netcom.com> wrote in message
news:uxjUzHH3IHA.1808@TK2MSFTNGP04.phx.gbl...
> Download VfpOleDB.dll
>
>
>
> "Joe" <jbassking@noemail.noemail> wrote in message
> news:%23mtyRsG3IHA.1420@TK2MSFTNGP06.phx.gbl...
>> Hi all.
>>
>> I'm trying to open a dbf file which appears to be FoxPro. I've tried
>> using the OLE and ODBC classes but I'm not having any luck.
>>
>> I keep getting an exception: "The Microsoft Jet database engine could not
>> find the object 'EQR_TRANSACTION_200803'. Make sure the object exists and
>> that you spell its name and the path name correctly."
>>
>> Here is the ODBC code:
>> try
>>
>> {
>>
>> string connString = @"DBQ=C:\Test;Driver={Microsoft dBase Driver
>> (*.dbf)}; DriverId=277";
>>
>>
>> OdbcConnection conn = new OdbcConnection(connString);
>>
>> OdbcDataAdapter da = new OdbcDataAdapter("select * from
>> EQR_TRANSACTION_200803", conn);
>>
>> DataTable table = new DataTable("table");
>>
>> da.Fill(table);
>>
>> dataGridView1.DataSource = table;
>>
>> }
>>
>> catch (Exception e)
>>
>> {
>>
>> MessageBox.Show(e.Message);
>>
>> }
>>
>>
>>
>> Any ideas?
>>
>>
>>
>> Thanks,
>>
>> Joe
>>
>>
>
>



Re: Read a Visual FoxPro dbf file. by Joe

Joe
Thu Jul 03 08:17:01 CDT 2008

Using the connection string from the link below it seems to connect but I
get an error message Cannot open file c:\test\eqr.dbc.

What is a dbc file? I can open the dbf using a few programs I downloaded but
cannot open it in C#.

"Jialiang Ge [MSFT]" <jialge@online.microsoft.com> wrote in message
news:%23LtMrXO3IHA.2336@TK2MSFTNGP03.phx.gbl...
> Hello
>
> I know some known scenarios where dBase Driver does not co-operate with
> Foxpro well. We generally suggest customers using OLE DB Provider for
> Visual FoxPro:
> http://www.microsoft.com/downloads/details.aspx?familyid=e1a87d8f-2d58-491f-a0fa-95a3289c5fd4&displaylang=en
>
> The sample connection strings based on Microsoft Visual FoxPro Driver can
> be found at:
> http://www.connectionstrings.com/?carrier=visualfoxpro
>
> Bill, would you please try the Foxpro driver instead? If you have any
> concerns about, please DON¡¯T hesitate to tell me.
>
> Regards,
> Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
>
> =================================================
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg@microsoft.com.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> =================================================
>
> "Jim Rand" <jimrand@ix.netcom.com> wrote in message
> news:uxjUzHH3IHA.1808@TK2MSFTNGP04.phx.gbl...
>> Download VfpOleDB.dll
>>
>>
>>
>> "Joe" <jbassking@noemail.noemail> wrote in message
>> news:%23mtyRsG3IHA.1420@TK2MSFTNGP06.phx.gbl...
>>> Hi all.
>>>
>>> I'm trying to open a dbf file which appears to be FoxPro. I've tried
>>> using the OLE and ODBC classes but I'm not having any luck.
>>>
>>> I keep getting an exception: "The Microsoft Jet database engine could
>>> not find the object 'EQR_TRANSACTION_200803'. Make sure the object
>>> exists and that you spell its name and the path name correctly."
>>>
>>> Here is the ODBC code:
>>> try
>>>
>>> {
>>>
>>> string connString = @"DBQ=C:\Test;Driver={Microsoft dBase Driver
>>> (*.dbf)}; DriverId=277";
>>>
>>>
>>> OdbcConnection conn = new OdbcConnection(connString);
>>>
>>> OdbcDataAdapter da = new OdbcDataAdapter("select * from
>>> EQR_TRANSACTION_200803", conn);
>>>
>>> DataTable table = new DataTable("table");
>>>
>>> da.Fill(table);
>>>
>>> dataGridView1.DataSource = table;
>>>
>>> }
>>>
>>> catch (Exception e)
>>>
>>> {
>>>
>>> MessageBox.Show(e.Message);
>>>
>>> }
>>>
>>>
>>>
>>> Any ideas?
>>>
>>>
>>>
>>> Thanks,
>>>
>>> Joe
>>>
>>>
>>
>>
>
>



Re: Read a Visual FoxPro dbf file. by Jialiang

Jialiang
Fri Jul 04 02:42:34 CDT 2008

Hello Joe,

¡°Dbc¡± is the file extension for Foxpro database; and ¡°dbf¡± is for tables
associated with the database. According to the error, it seems that you are
using the connection string:

Driver={Microsoft Visual FoxPro
Driver};SourceType=DBC;SourceDB=c:\myvfpdb.dbc;Exclusive=No;
NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;

To connect to the database container (.dbc), and it fails to find the dbc?

Please try the connection strings for ¡°Free table directory¡±. The DBF
(free table) connection string only refers to the directory containing the
DBF, it does not specify a target table. All free tables within the
directory are then available for use in the recordset SQL statement.

You may also want to read Cindy Winegarden [Foxpro MVP]¡¯s comments in this
thread:
http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.adonet/topic35499.aspx

Regards,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

"Joe" <jbassking@noemail.noemail> wrote in message
news:e4HDn8Q3IHA.1192@TK2MSFTNGP05.phx.gbl...
> Using the connection string from the link below it seems to connect but I
> get an error message Cannot open file c:\test\eqr.dbc.
>
> What is a dbc file? I can open the dbf using a few programs I downloaded
> but cannot open it in C#.
>
> "Jialiang Ge [MSFT]" <jialge@online.microsoft.com> wrote in message
> news:%23LtMrXO3IHA.2336@TK2MSFTNGP03.phx.gbl...
>> Hello
>>
>> I know some known scenarios where dBase Driver does not co-operate with
>> Foxpro well. We generally suggest customers using OLE DB Provider for
>> Visual FoxPro:
>> http://www.microsoft.com/downloads/details.aspx?familyid=e1a87d8f-2d58-491f-a0fa-95a3289c5fd4&displaylang=en
>>
>> The sample connection strings based on Microsoft Visual FoxPro Driver can
>> be found at:
>> http://www.connectionstrings.com/?carrier=visualfoxpro
>>
>> Bill, would you please try the Foxpro driver instead? If you have any
>> concerns about, please DON¡¯T hesitate to tell me.
>>
>> Regards,
>> Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
>> Microsoft Online Community Support
>>
>> =================================================
>> Delighting our customers is our #1 priority. We welcome your comments and
>> suggestions about how we can improve the support we provide to you.
>> Please feel free to let my manager know what you think of the level of
>> service provided. You can send feedback directly to my manager at:
>> msdnmg@microsoft.com.
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> =================================================
>>
>> "Jim Rand" <jimrand@ix.netcom.com> wrote in message
>> news:uxjUzHH3IHA.1808@TK2MSFTNGP04.phx.gbl...
>>> Download VfpOleDB.dll
>>>
>>>
>>>
>>> "Joe" <jbassking@noemail.noemail> wrote in message
>>> news:%23mtyRsG3IHA.1420@TK2MSFTNGP06.phx.gbl...
>>>> Hi all.
>>>>
>>>> I'm trying to open a dbf file which appears to be FoxPro. I've tried
>>>> using the OLE and ODBC classes but I'm not having any luck.
>>>>
>>>> I keep getting an exception: "The Microsoft Jet database engine could
>>>> not find the object 'EQR_TRANSACTION_200803'. Make sure the object
>>>> exists and that you spell its name and the path name correctly."
>>>>
>>>> Here is the ODBC code:
>>>> try
>>>>
>>>> {
>>>>
>>>> string connString = @"DBQ=C:\Test;Driver={Microsoft dBase Driver
>>>> (*.dbf)}; DriverId=277";
>>>>
>>>>
>>>> OdbcConnection conn = new OdbcConnection(connString);
>>>>
>>>> OdbcDataAdapter da = new OdbcDataAdapter("select * from
>>>> EQR_TRANSACTION_200803", conn);
>>>>
>>>> DataTable table = new DataTable("table");
>>>>
>>>> da.Fill(table);
>>>>
>>>> dataGridView1.DataSource = table;
>>>>
>>>> }
>>>>
>>>> catch (Exception e)
>>>>
>>>> {
>>>>
>>>> MessageBox.Show(e.Message);
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>> Any ideas?
>>>>
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Joe
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: Read a Visual FoxPro dbf file. by Joe

Joe
Fri Jul 04 06:13:39 CDT 2008

Hello,

Here is the code I am running:
string connString = @"Provider=vfpoledb.1;Data Source=C:\test\;Collating
Sequence=general;";

OleDbConnection conn = new OleDbConnection(connString);

OleDbDataAdapter da = new OleDbDataAdapter("select * from
EQR_TRANSACTION_200803.dbf", conn);
DataTable table = new DataTable("table");
da.Fill(table);

The connString doesn't mention the dbc. Also I don't know where it even gets
the name of the dbc it is looking for.

-Joe

"Jialiang Ge [MSFT]" <jialge@online.microsoft.com> wrote in message
news:uFMUHma3IHA.1436@TK2MSFTNGP05.phx.gbl...
> Hello Joe,
>
> ¡°Dbc¡± is the file extension for Foxpro database; and ¡°dbf¡± is for
> tables associated with the database. According to the error, it seems that
> you are using the connection string:
>
> Driver={Microsoft Visual FoxPro
> Driver};SourceType=DBC;SourceDB=c:\myvfpdb.dbc;Exclusive=No;
> NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;
>
> To connect to the database container (.dbc), and it fails to find the dbc?
>
> Please try the connection strings for ¡°Free table directory¡±. The DBF
> (free table) connection string only refers to the directory containing the
> DBF, it does not specify a target table. All free tables within the
> directory are then available for use in the recordset SQL statement.
>
> You may also want to read Cindy Winegarden [Foxpro MVP]¡¯s comments in
> this thread:
> http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.adonet/topic35499.aspx
>
> Regards,
> Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
>
> =================================================
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg@microsoft.com.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> =================================================
>
> "Joe" <jbassking@noemail.noemail> wrote in message
> news:e4HDn8Q3IHA.1192@TK2MSFTNGP05.phx.gbl...
>> Using the connection string from the link below it seems to connect but I
>> get an error message Cannot open file c:\test\eqr.dbc.
>>
>> What is a dbc file? I can open the dbf using a few programs I downloaded
>> but cannot open it in C#.
>>
>> "Jialiang Ge [MSFT]" <jialge@online.microsoft.com> wrote in message
>> news:%23LtMrXO3IHA.2336@TK2MSFTNGP03.phx.gbl...
>>> Hello
>>>
>>> I know some known scenarios where dBase Driver does not co-operate with
>>> Foxpro well. We generally suggest customers using OLE DB Provider for
>>> Visual FoxPro:
>>> http://www.microsoft.com/downloads/details.aspx?familyid=e1a87d8f-2d58-491f-a0fa-95a3289c5fd4&displaylang=en
>>>
>>> The sample connection strings based on Microsoft Visual FoxPro Driver
>>> can be found at:
>>> http://www.connectionstrings.com/?carrier=visualfoxpro
>>>
>>> Bill, would you please try the Foxpro driver instead? If you have any
>>> concerns about, please DON¡¯T hesitate to tell me.
>>>
>>> Regards,
>>> Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
>>> Microsoft Online Community Support
>>>
>>> =================================================
>>> Delighting our customers is our #1 priority. We welcome your comments
>>> and suggestions about how we can improve the support we provide to you.
>>> Please feel free to let my manager know what you think of the level of
>>> service provided. You can send feedback directly to my manager at:
>>> msdnmg@microsoft.com.
>>>
>>> This posting is provided "AS IS" with no warranties, and confers no
>>> rights.
>>> =================================================
>>>
>>> "Jim Rand" <jimrand@ix.netcom.com> wrote in message
>>> news:uxjUzHH3IHA.1808@TK2MSFTNGP04.phx.gbl...
>>>> Download VfpOleDB.dll
>>>>
>>>>
>>>>
>>>> "Joe" <jbassking@noemail.noemail> wrote in message
>>>> news:%23mtyRsG3IHA.1420@TK2MSFTNGP06.phx.gbl...
>>>>> Hi all.
>>>>>
>>>>> I'm trying to open a dbf file which appears to be FoxPro. I've tried
>>>>> using the OLE and ODBC classes but I'm not having any luck.
>>>>>
>>>>> I keep getting an exception: "The Microsoft Jet database engine could
>>>>> not find the object 'EQR_TRANSACTION_200803'. Make sure the object
>>>>> exists and that you spell its name and the path name correctly."
>>>>>
>>>>> Here is the ODBC code:
>>>>> try
>>>>>
>>>>> {
>>>>>
>>>>> string connString = @"DBQ=C:\Test;Driver={Microsoft dBase Driver
>>>>> (*.dbf)}; DriverId=277";
>>>>>
>>>>>
>>>>> OdbcConnection conn = new OdbcConnection(connString);
>>>>>
>>>>> OdbcDataAdapter da = new OdbcDataAdapter("select * from
>>>>> EQR_TRANSACTION_200803", conn);
>>>>>
>>>>> DataTable table = new DataTable("table");
>>>>>
>>>>> da.Fill(table);
>>>>>
>>>>> dataGridView1.DataSource = table;
>>>>>
>>>>> }
>>>>>
>>>>> catch (Exception e)
>>>>>
>>>>> {
>>>>>
>>>>> MessageBox.Show(e.Message);
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> Any ideas?
>>>>>
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Joe
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: Read a Visual FoxPro dbf file. by jialge

jialge
Mon Jul 07 05:50:41 CDT 2008

Hello Joe,

As is mentioned in the quote of Cindy Winegarden [MVP]'s messages, there
are basically two types of tables (dbf).

1. Free table.
This type of table can be created by Foxpro->File menu->New->Table
It can exist without dbc files.

2. Table with a link to its database.
This type of table is created by Foxpro->File menu->New->Database (create a
dbc file)->New Table (create a dbf file)
If you move away dbc and open this type of dbf with foxpro, Foxpro pops up
an error message:
"C:\testdb\data1.dbc: The database for table 'C:\testdb\table1.dbf' could
not be opened. Would you like to try to locate the owning database or
delete the link (and free the table)."
By clicking the "Delete" button, the table will become a free table (of the
first type).

The error message "cannot open dbc" tells me that you are using a dbf file
of the second type. Please remove the link to dbc by the above-mentioned
method. Based on my own tests, your code snippet runs well as long as the
link is removed.

Regards,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================


Re: Read a Visual FoxPro dbf file. by jialge

jialge
Thu Jul 10 07:14:00 CDT 2008

Hello Joe

I am writing to check the status of the issue on your side. Would you mind
letting me know the result of the suggestions? If you need further
assistance, feel free to let me know. I will be more than happy to be of
assistance.

Have a great day!

Regards,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================


Re: Read a Visual FoxPro dbf file. by Joe

Joe
Mon Jul 14 08:08:31 CDT 2008

Sorry for not replying in. I've been away.

""Jialiang Ge [MSFT]"" <jialge@online.microsoft.com> wrote in message
news:7EVp1Zo4IHA.1624@TK2MSFTNGHUB02.phx.gbl...
> Hello Joe
>
> I am writing to check the status of the issue on your side. Would you mind
> letting me know the result of the suggestions? If you need further
> assistance, feel free to let me know. I will be more than happy to be of
> assistance.
>
> Have a great day!
>
> Regards,
> Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
>
> =================================================
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg@microsoft.com.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> =================================================
>



Re: Read a Visual FoxPro dbf file. by Joe

Joe
Mon Jul 14 08:12:45 CDT 2008

I do not have FoxPro so I cannot do as you're suggesting. I tried a program
called DBF Viewer 2000 (http://www.dbf2002.com/) and this opens it fine.
I need a general solution for opening dbf files. I cannot rely on the end
user to have FoxPro and need to delete the link.

There has to be some other reason this doesn't work. Are there other
parameters that can be passed in the connection string that tells it not to
look for the dbc file?

""Jialiang Ge [MSFT]"" <jialge@online.microsoft.com> wrote in message
news:arRuR9B4IHA.1624@TK2MSFTNGHUB02.phx.gbl...
> Hello Joe,
>
> As is mentioned in the quote of Cindy Winegarden [MVP]'s messages, there
> are basically two types of tables (dbf).
>
> 1. Free table.
> This type of table can be created by Foxpro->File menu->New->Table
> It can exist without dbc files.
>
> 2. Table with a link to its database.
> This type of table is created by Foxpro->File menu->New->Database (create
> a
> dbc file)->New Table (create a dbf file)
> If you move away dbc and open this type of dbf with foxpro, Foxpro pops up
> an error message:
> "C:\testdb\data1.dbc: The database for table 'C:\testdb\table1.dbf' could
> not be opened. Would you like to try to locate the owning database or
> delete the link (and free the table)."
> By clicking the "Delete" button, the table will become a free table (of
> the
> first type).
>
> The error message "cannot open dbc" tells me that you are using a dbf file
> of the second type. Please remove the link to dbc by the above-mentioned
> method. Based on my own tests, your code snippet runs well as long as the
> link is removed.
>
> Regards,
> Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
>
> =================================================
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg@microsoft.com.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> =================================================
>