How to specify numeric width and precision when creating a dBase database?
- by Stevo3000
We need to be able to create a dBase database (.dbf file) containing numeric columns with specific width and precision. I seem to be able to set the precision but not the width. The following code shows my connection string and my command text.
using (OleDbConnection oConnection = new OleDbConnection(String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = {0};Extended Properties=dBase 5.0", msPath)))
{
....
oCommand.CommandText = "CREATE TABLE [Field] ([Id] Numeric (15, 3))";
oCommand.ExecuteNonQuery();
}
This gives me a column Id,20,3 in the file.
There must be a way to set the field width without resorting to editing the .dbf file manually? Has nobody else come across this before when creating shapefiles?