On Thu, 1 Jul 2004 21:29:01 -0700, "Enzo" <enzomaini (AT) dotnetfan (DOT) net> wrote:
¤ Ok, what is the trick!!!
¤
¤ I am using C# to read a FoxPro DBF file.
¤
¤ I do the following:
¤
¤ Private DataSet getDBFData(string dbfFile)
¤ {
¤ DataSet ds = new DataSet();
¤ string Sql;
¤ int dbfNameStart = dbfFile.LastIndexOf(@"\");
¤ string dbfTableName = dbfFile.Substring(dbfNameStart + 1);
¤ //Define a connection string with file path as parameter
¤ string Connection = "Provider=MSDASQL/SQLServer ODBC;Driver={Microsoft Visual FoxPro Driver};" +
¤ @"SourceType=DBF;SourceDB=D:\DA197\OfficeDepot\Cle aned Data;" +
¤ "InternetTimeout=300000;Transact Updates=True";
¤
¤ //This simple query is all u need to extract data. Make sure you specify filename
¤ //with extension
¤ Sql = "select * from " + dbfTableName;
¤ OdbcDataAdapter OdbcConn = new OdbcDataAdapter(Sql, Connection);
¤ OdbcConn.Fill(ds);
¤ OdbcConn.Dispose();
¤
¤ return ds;
¤ }
¤
¤ The problem is that the file has a date field and it is return like this: 36459.704756944
¤
¤ First of all, why does the driver return it like this and not a normal date, and second, how do I fix this problem???
Yeah, that looks rather bizarre. Have you tried using the OLEDB provider?
http://www.microsoft.com/downloads/d...displaylang=en http://www.able-consulting.com/MDAC/...orVisualFoxPro
Paul ~~~ pclement (AT) ameritech (DOT) net
Microsoft MVP (Visual Basic)