Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.dotnet.framework.odbcnet
Re: Reading FoxPro Date field frpm ODBC
Paul Clement
7/6/2004 9:46:00 PM
On Thu, 1 Jul 2004 21:29:01 -0700, "Enzo" <enzomaini@dotnetfan.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\Cleaned 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/details.aspx?familyid=0f43eb58-7a94-4ae1-a59e-965869cb3bc9&disp...
http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForVi...
Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Reading FoxPro Date field frpm ODBC
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password