473,396 Members | 1,866 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,396 software developers and data experts.

DBASE file connection problem :(

Hi all,

I wanted to connect an old DBASE file (I don't know the exact version) but I
could not make it at all. I couldn't find a way to execute sql statements on
db file using c#. The interesting thing my old client can connect to the
database and fetch data properly.

I tried all possibilities that I found on the web containing using ODBC
driver and importing the data into an access file and using this file
instead of working on the original file but I couldn't achieve these too.

I also used the all connections strings that connectionstrings.com suggests
but this didn't work too.

My data folder consists of a DBF, FPT and CDX file (afaik this file comes
only with the newer versions of DBASE). This may be helpful for you.

Any help will be appreciated.
Thanks in advance.
Apr 3 '07 #1
6 3773
Alenya,

The most important thing that you left out was the code that you are
using to access the file! Are you using the classes from the
System.Data.Odbc namespace? You mentioned an ODBC driver, and this is the
namespace that you would use to connect to data sources through ODBC
drivers.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Aleyna[]" <xo******@gmail.comwrote in message
news:Oh**************@TK2MSFTNGP02.phx.gbl...
Hi all,

I wanted to connect an old DBASE file (I don't know the exact version) but
I could not make it at all. I couldn't find a way to execute sql
statements on db file using c#. The interesting thing my old client can
connect to the database and fetch data properly.

I tried all possibilities that I found on the web containing using ODBC
driver and importing the data into an access file and using this file
instead of working on the original file but I couldn't achieve these too.

I also used the all connections strings that connectionstrings.com
suggests but this didn't work too.

My data folder consists of a DBF, FPT and CDX file (afaik this file comes
only with the newer versions of DBASE). This may be helpful for you.

Any help will be appreciated.
Thanks in advance.

Apr 3 '07 #2
Thanks for reminding...

I used the following code:

string dbName = "dsn=lugat";

OdbcConnection odbcConn = new OdbcConnection(dbName);
try
{
odbcConn.Open();
//I write all tables into an XML file in order to ensure it works properly
or not
odbcConn.GetSchema(OdbcMetaDataCollectionNames.Tab les).WriteXml("TABLES.XML"); string cmdText = "Select * from LUGAT"; OdbcCommand cmd = new OdbcCommand(cmdText,odbcConn); OdbcDataReader reader = cmd.ExecuteReader();}catch (Exception e){ throw e;}finally{ odbcConn.Close();}and this is what the code writes to the TABLES.XML file<?xml version="1.0" standalone="yes"?><DocumentElement <Tables <TABLE_CAT>D:\LUGAT</TABLE_CAT <TABLE_NAME>LUGAT</TABLE_NAME <TABLE_TYPE>TABLE</TABLE_TYPE </Tables <Tables <TABLE_CAT>D:\LUGAT</TABLE_CAT <TABLE_NAME>LUGAT_SET</TABLE_NAME <TABLE_TYPE>TABLE</TABLE_TYPE </Tables></DocumentElement>However when I tried to access the db using the select statement it throwsan exception saying"Error [HY000][Microsoft][ODBC dBase Driver] External table is not in theexpected format."any ideas?"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com>, haberiletisinde şunları yazdı:On**************@TK2MSFTNGP03.phx.gbl...Alen ya,> The most important thing that you left out was the code that you areusing to access the file! Are you using the classes from theSystem.Data.Odbc namespace? You mentioned an ODBC driver, and this is thenamespace that you would use to connect to data sources through ODBCdrivers.> Hope this helps.>>-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com>"Aleyna[]" <xo******@gmail.comwrote in messagenews:Oh**************@TK2MSFTNGP02.phx.gbl. ..>Hi all,>>>I wanted to connect an old DBASE file (I don't know the exact version)but I could not make it at all. I couldn't find a way to execute sqlstatements on db file using c#. The interesting thing my old client canconnect to the database and fetch data properly.>>>I tried all possibilities that I found on the web containing using ODBCdriver and importing the data into an access file and using this fileinstead of working on the original file but I couldn't achieve these too.>>>I also used the all connections strings that connectionstrings.comsuggests but this didn't work too.>>>My data folder consists of a DBF, FPT and CDX file (afaik this file comesonly with the newer versions of DBASE). This may be helpful for you.>>>Any help will be appreciated.>Thanks in advance.>>>>

Apr 3 '07 #3
A dbase file, not a forpro db file? what version?

maybe,you should translate it to forpro3.0 file first.(using vfp6)
Apr 4 '07 #4
A dBase file. I do not know the version but tried to connect using dBASE 3,4
and 5 drivers.

Now I found a tool to transfer the data into a mySQL db however still I
could not understand why I cannot connect and query properly whereas others
can make it.
"gshzheng" <gs******@gmail.com>, haber iletisinde şunları
yazdı:%2****************@TK2MSFTNGP04.phx.gbl...
>A dbase file, not a forpro db file? what version?

maybe,you should translate it to forpro3.0 file first.(using vfp6)



Apr 4 '07 #5


hi alena,
if u want to connect using SSIS means i can help.otherwise so sorry.

thx
sr*********@gmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Feb 1 '08 #6
hi alenya,
if needed to connect using SSIS means i can help u. otherwise so sorry

thx
sreejith

*** Sent via Developersdex http://www.developersdex.com ***
Feb 1 '08 #7

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

Similar topics

9
by: Stan Cook | last post by:
Does anyone know how or what I can use to open, read and extract data from a dbase database? I haven't found anything of much use with accompanying documentation.
4
by: Matt Young | last post by:
I've been tasked with integrating an older management system based on DBF files with my snappy new ASP application to provide users of the ASP application with real-time data from the management...
10
by: level8 | last post by:
I would like to see a Clipper/dbase DBF file as a table in SQL Server 7.0. How can I SELECT rows from DBF file? Should I use OLE DB Provider or ODBC, and how?
3
by: Kshitij Rajhans | last post by:
HI, How to connect to the dBase database?? One option is to create a DSN and use it.But I want to do it in some other way like just passing a connection string or like that. Thanks in...
1
by: Derek Griffiths | last post by:
Most of the complicated programs I write are boring applications that manipulate databases associated with the medical billing program where I work. The program uses foxpro dbases (version 3) for...
6
by: Tomek | last post by:
Hi, Please help me with Data Connections into dBase files. I have catalog with lot of files like *.dbf and *.mdx . Every file contains one table (I can see it in MS Access). How can I make...
4
by: JeffP | last post by:
datagrid1 has a single column contact I'm getting an invalid datasource at... Me.DataGrid1.DataSource = cmd I don't want to use the methods here, I usually use SQLHelper psuedo code: dim ds...
2
by: bcbrock | last post by:
I am trying to figure out how to query some data out of a dbase IV (.dbf) file sitting on a remote server from my MySQL/PHP/Web Server. Both servers are Windows Server 2003 SP2. My...
1
by: JFB | last post by:
Hi, I have a connection to a dbase IV file using oledb. I wan to do an update to a field using a vb function passing two parameters. These 2 parameters are fields from the same table. What is the...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.