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.>>>>