|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Connect to Foxpro Data (*.DBF) in VB.NetWe are currently write a program to "Transfer" Data from old system. How can i connect to a set of DBF files by What is the connection string to connect the DBF? I have try this one but error. connstr = "Provider = VFPOLEDB;Data Source=" & "C:\ESS2001\DATA\" I have the following question? 1. Does [OleDBConnection] Object support DBF Files? or i should use [ODBCConnection] ? 2. Should I it a must to have a "*.dbc" file ? 3. I need to use ADO instead of ADO.Net in VB.Net ? Thank you for your help in advance! -- EricLun Eric,
She will answer you probably as well. It seems she is busy again in this newsgroups. However if not, have a look at these ansered messages. http://groups.google.com/group/microsoft.public.dotnet.framework.adonet/search?group=microsoft.public.dotnet.framework.adonet&q=winegarden&qt_g=1&searchnow=Search+this+group I hope this helps, Cor Hi Cor,
Thanks! :-) -- Show quoteCindy Winegarden MCSD, Microsoft Visual FoxPro MVP cindy_winegar***@msn.com www.cindywinegarden.com "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%23MnYZZEEGHA.1028@TK2MSFTNGP11.phx.gbl... > Eric, > > She will answer you probably as well. It seems she is busy again in this > newsgroups. > > However if not, have a look at these ansered messages. > > http://groups.google.com/group/microsoft.public.dotnet.framework.adonet/search?group=microsoft.public.dotnet.framework.adonet&q=winegarden&qt_g=1&searchnow=Search+this+group > > I hope this helps, > > Cor > Hi Eric,
First of all, be sure you have the latest FoxPro and Visual FoxPro OLE DB data provider, available from msdn.microsoft.com/vfoxpro/downloads/updates. ODBC is an older technology and does not support all versions of FoxPro tables. FoxPro tables come in 3 parts: the DBF is the main table, the FPT (optional) is the contents of Memo fields, and the CDX (also optional) is the associated index file. All three of these generally named the same excepting the extension and if your table has Memo fields and indexes then the FPT and CDX must be present. There are two ways Fox tables are organized. First, there are "free" tables. With free tables a DBC file is not present and the connection string should reference only the directory where the files are found, as you have done below. Second, Fox tables can be associated with a "Database Container" (DBC, DCT memo, and DCX index files) which contains metadata about the tables and other features such as stored procedures and triggers. If a DBC is present the path in your connection string should be something like "C:\ESS2001\DATA\Whatever.dbc" . You can use the same types of ADO.NET code for Fox tables as you would for any other OLE DB-compliant data source. -- Show quoteCindy Winegarden MCSD, Microsoft Visual FoxPro MVP cindy_winegar***@msn.com www.cindywinegarden.com "EricLun" <eric_kly***@hotmail.com> wrote in message news:127B59E8-4035-47DD-8C60-1BB7AFC249AD@microsoft.com... > How can i connect to a set of DBF files by > What is the connection string to connect the DBF? > I have try this one but error. > connstr = "Provider = VFPOLEDB;Data Source=" & "C:\ESS2001\DATA\" > > I have the following question? > 1. Does [OleDBConnection] Object support DBF Files? or i should use > [ODBCConnection] ? > 2. Should I it a must to have a "*.dbc" file ? > 3. I need to use ADO instead of ADO.Net in VB.Net ? Hi Cindy,
I have fixed my problem after i download the OleDB Provider for VFP 9.0 in Microsoft Site http://www.microsoft.com/downloads/details.aspx?FamilyID=e1a87d8f-2d58-491f-a0fa-95a3289c5fd4&DisplayLang=en My Connection String as follow is workable "Provider = VFPOLEDB;Data Source=C:\DBFPath\To_eric;Mode=Read;Collating Sequence=MACHINE;" I am using "Free Table" method as my user would like to choose where even "DBF" file they need. Thank you for you and other help. -- Show quoteEricLun "Cindy Winegarden" wrote: > Hi Eric, > > First of all, be sure you have the latest FoxPro and Visual FoxPro OLE DB > data provider, available from msdn.microsoft.com/vfoxpro/downloads/updates. > ODBC is an older technology and does not support all versions of FoxPro > tables. > > FoxPro tables come in 3 parts: the DBF is the main table, the FPT (optional) > is the contents of Memo fields, and the CDX (also optional) is the > associated index file. All three of these generally named the same excepting > the extension and if your table has Memo fields and indexes then the FPT and > CDX must be present. > > There are two ways Fox tables are organized. First, there are "free" tables. > With free tables a DBC file is not present and the connection string should > reference only the directory where the files are found, as you have done > below. > > Second, Fox tables can be associated with a "Database Container" (DBC, DCT > memo, and DCX index files) which contains metadata about the tables and > other features such as stored procedures and triggers. If a DBC is present > the path in your connection string should be something like > "C:\ESS2001\DATA\Whatever.dbc" . > > You can use the same types of ADO.NET code for Fox tables as you would for > any other OLE DB-compliant data source. > > > -- > Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP > cindy_winegar***@msn.com www.cindywinegarden.com > > > "EricLun" <eric_kly***@hotmail.com> wrote in message > news:127B59E8-4035-47DD-8C60-1BB7AFC249AD@microsoft.com... > > > How can i connect to a set of DBF files by > > What is the connection string to connect the DBF? > > I have try this one but error. > > connstr = "Provider = VFPOLEDB;Data Source=" & "C:\ESS2001\DATA\" > > > > I have the following question? > > 1. Does [OleDBConnection] Object support DBF Files? or i should use > > [ODBCConnection] ? > > 2. Should I it a must to have a "*.dbc" file ? > > 3. I need to use ADO instead of ADO.Net in VB.Net ? > > > Hi Eric,
Just to be clear, if a DBC file is present you should assume all the tables in that directory belong to it (although they don't have to) and connect to the DBC. The Fox data engine uses the metadata in the DBC to find the tables you reference in your app. If there is no DBC then the tables are most likely free tables. I say "most likely" because the DBC is not required to be in the same directory as the DBFs. Also, if the tables have been copied from one directory to another the DBC may not have been included in the copying. This would, of course, cause problems. Free tables and tables belonging to a DBC can be mixed in the same directory. However, with a free table directory connection the tables contained by the DBC will not be recognized, and with a connection to the DBC, any free tables in that directory will not be recognized. This probably way overcomplicates your situation but I thought I'd discuss it, since someone searching the archives may need to know these details. -- Show quoteCindy Winegarden MCSD, Microsoft Visual FoxPro MVP cindy_winegar***@msn.com www.cindywinegarden.com "EricLun" <eric_kly***@hotmail.com> wrote in message news:AFACE1BA-1D55-43B2-95EE-C03142EB3E3E@microsoft.com... > I am using "Free Table" method as my user would like to choose where even > "DBF" file they need. I got it! Thank you very much
-- Show quoteEricLun "Cindy Winegarden" wrote: > Hi Eric, > > Just to be clear, if a DBC file is present you should assume all the tables > in that directory belong to it (although they don't have to) and connect to > the DBC. The Fox data engine uses the metadata in the DBC to find the tables > you reference in your app. > > If there is no DBC then the tables are most likely free tables. I say "most > likely" because the DBC is not required to be in the same directory as the > DBFs. Also, if the tables have been copied from one directory to another the > DBC may not have been included in the copying. This would, of course, cause > problems. > > Free tables and tables belonging to a DBC can be mixed in the same > directory. However, with a free table directory connection the tables > contained by the DBC will not be recognized, and with a connection to the > DBC, any free tables in that directory will not be recognized. > > This probably way overcomplicates your situation but I thought I'd discuss > it, since someone searching the archives may need to know these details. > > -- > Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP > cindy_winegar***@msn.com www.cindywinegarden.com > > > "EricLun" <eric_kly***@hotmail.com> wrote in message > news:AFACE1BA-1D55-43B2-95EE-C03142EB3E3E@microsoft.com... > > > I am using "Free Table" method as my user would like to choose where even > > "DBF" file they need. > > > > On Tue, 3 Jan 2006 00:52:02 -0800, "EricLun" <eric_kly***@hotmail.com> wrote: ¤ Dear All¤ ¤ We are currently write a program to "Transfer" Data from old system. ¤ ¤ How can i connect to a set of DBF files by ¤ What is the connection string to connect the DBF? ¤ I have try this one but error. ¤ connstr = "Provider = VFPOLEDB;Data Source=" & "C:\ESS2001\DATA\" ¤ What is the name of your database? I don't see it in the connection string. ¤ I have the following question? ¤ 1. Does [OleDBConnection] Object support DBF Files? or i should use ¤ [ODBCConnection] ? Yes. No don't use ODBC. Those drivers are outdated. ¤ 2. Should I it a must to have a "*.dbc" file ? I believe that would be required by the OLEDB provider, yes. ¤ 3. I need to use ADO instead of ADO.Net in VB.Net ? No, you can use ADO.NET. Paul ~~~~ Microsoft MVP (Visual Basic) Hi Paul,
See my post in this thread for a little discussion of working with Fox data in .NET. :-) -- Show quoteCindy Winegarden MCSD, Microsoft Visual FoxPro MVP cindy_winegar***@msn.com www.cindywinegarden.com "Paul Clement" <UseAdddressAtEndofMess***@swspectrum.com> wrote in message news:c8glr1t88cpdpl9kh9ius7fhac85q9h36c@4ax.com... > ¤ connstr = "Provider = VFPOLEDB;Data Source=" & "C:\ESS2001\DATA\" > What is the name of your database? I don't see it in the connection > string. > ¤ 2. Should I it a must to have a "*.dbc" file ? > I believe that would be required by the OLEDB provider, yes. |
|||||||||||||||||||||||