Message 1 of 8
DataTable AppendRow fail

Not applicable
12-01-2011
07:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
.Net, C-Sharp:
I've got configuration data that I'd like to save in a DataTable, but when I load the data into a DataCellCollection, append that to a DataTable, then check the number of cells in the appended row, it looks like the row loses all the cells that it had.
Partial code:
namespace GIS_DuctTape { using System; using System.Collections.Generic; using System.Diagnostics; using Autodesk.AutoCAD.DatabaseServices; public class DuctTapeConfig { //... public DataTable MakeTable() { Debug.WriteLine("DuctTapeConfig#MakeTable() - start"); DataTable table = new DataTable(); table.AppendColumn(CellType.CharPtr, "SourceFile"); table.AppendColumn(CellType.CharPtr, "Feature"); table.AppendColumn(CellType.CharPtr, "AttributeFields"); table.AppendColumn(CellType.CharPtr, "Layer"); foreach(FeatureInfo fi in FeaturesList) { DataCellCollection row = fi.AsDataTableRow; Debug.WriteLine(" input row has " + row.Count + " cells." ); table.AppendRow(row, false); Debug.WriteLine(" table row " + (table.NumRows - 1) + " has " + table.GetRowAt(table.NumRows - 1).Count + " cells." ); } Debug.Flush(); return table; } //... } }
Log file output:
DuctTapeConfig#MakeTable() - start input row has 4 cells. table row 0 has 0 cells.
Any idea what's wrong?