Adding data to DBF file adds column _NullFlags

952 views Asked by At

Im currently working on a program that gets information from a sql database and creates a .DBF that has the information in there. I got it to the point where it makes the file and adds the columns/rows. But every time I run it, it adds a column named _NullFlags and I would prefer not to have it on the file. how would I go about that?

//Create dbf file
OleDbCommand cmd1 = new OleDbCommand("Create Table '" + leverancier + "' (Best N(5), Aanb N(5), Art C(8), Ref C(60), Oms C(40), Plan D, Rem C(40))", con);
cmd1.ExecuteNonQuery();


//add row
OleDbCommand cmd2 = new OleDbCommand(@"Insert Into '" + leverancier + "'(Best,Aanb,Art,Ref,Oms,Plan,Rem) Values (?,?,?,?,?,?,?)", con);
cmd2.Parameters.AddWithValue("?", Convert.ToInt32(DRorder["BEST"]));
cmd2.Parameters.AddWithValue("?", Convert.ToInt32(DRorder["AANB"]));
cmd2.Parameters.AddWithValue("?", Convert.ToString(DRorder["ART"]));
cmd2.Parameters.AddWithValue("?", "ref");
cmd2.Parameters.AddWithValue("?", Convert.ToString(DRorder["OMS"]));
cmd2.Parameters.AddWithValue("?", Convert.ToDateTime(DRorder["PLAN"]));
cmd2.Parameters.AddWithValue("?", "rem");
cmd2.ExecuteNonQuery();
1

There are 1 answers

0
Ethan Furman On BEST ANSWER

_NullFlags is a private field that is used by the dbf to keep track of which fields can have a Null value.

If you really don't want it, try adding a not null after every field:

Best N(5) not null, Aanb N(5) not null, ...