This project is read-only.

DataColumn width and precision

Sep 30, 2011 at 2:52 PM

I am looking for help to define datacolumn width for string data and precision for double values. Here is what I have but it does not works as I expect:

    FeatureSet fs = new FeatureSet(FeatureType.Point); 
  
    // Create a DataColumn and set various properties.
    DataColumn col = new DataColumn();
    col.DataType = typeof(string);
    col.ColumnName = "HND";
 
 // col.MaxLength = 8;              ?????
 // col.Width = 8;       >>>> for  typeof(string);      ?????
 // col.Precision     >>>> for  typeof(double);      ?????

    fs.DataTable.Columns.Add(col);

        DotSpatial.Topology.Point p = new DotSpatial.Topology.Point();
        p.X = 100;
        p.Y = 200;   
        Feature f = new Feature(p);
        fs.Features.Add(f);

        f.DataRow.BeginEdit();
        f.DataRow["HND"] = "CAR"; 
        f.DataRow.EndEdit();

Thanks for help, vzavec

Sep 30, 2011 at 10:06 PM

The DataTable and DataColumn class have no awareness of precision.

As far as I know the current representation (implementation) ignores this issue. Some databases, for example, do support precision and width, so DataProvider may need some adjustments.