Reputation: 389
I create DBF files using JET oleDb 4.0, but the numeric fields always end up being (20.5) size. This is a known problem from what I read on the net. Many people are suggesting to use the Visual FoxPro oleDb which I tried, but I need to open the DBF files in ArcMap and I get errors about incorrect field types. I guess that the file format is not supported. If I open a DBF created with the FoxPro oledb in FoxPro and I export it in DBase IV format, then I can open it in ArcMap.
But when I create it, I already use the "Extended Properties=dBase IV" option, and it does not seems to do anything at all.
I have to find a way to get the correct field sizes in DBASE IV format. Can someone help me?
Here is my connection strings:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=dBase IV; Which makes always makes numeric in 20.5 size
Provider=vfpoledb;Data Source={0};Collating Sequence=general;Extended Properties=dBase IV; Which makes incompatible DBF for ArcMap
Upvotes: 2
Views: 677
Reputation: 48139
Take a look at this answer for encoding.
It uses the VFP OleDB provider, just ignore the context of the CODEPAGE references. The create table syntax will be similar and you can define your numeric fields as needed. The next critical part is the use of the VFPScript in the section...
string vfpScript = @"use MyTest1
Copy to MyTest2 type foxplus";
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "ExecScript";
command.Parameters.Add("myScript", OleDbType.Char).Value = vfpScript;
command.ExecuteNonQuery();
This takes the .dbf file from a VFP normal file header to a dBASE compatible (early FoxPro) file header which SHOULD be compatible with what you need.
Upvotes: 1