Create a new columns in dbf file

Jun 13, 2012 at 3:32 PM

I've to add a new empty columns by programmation to a DBF file. I use FastDBF library for many others function but when I just create a DbfColumn and add it to an unlocked header every records are shifted and my database data structure are destroyed. How is possible to add a new columns without this disagreement.



Guillaume Langlois


I pasted my code below (MIdb is a MapInfo dbf database file)

private void DbaseAddColumn(string newColumnName, ColumnType CT, int length = 10, int prec = 1)


DbfFile MIdb = new DbfFile();       

MIdb.Open(Path, FileMode.OpenOrCreate);


         DbfColumn nCol = new DbfColumn(newColumnName, (DbfColumn.DbfColumnType)CT,     length, prec);