I'm getting the error message seen below when trying to utilize the getdatafromdbf or updatedbfdata methods of a shapefilefeaturesource. These methods have worked in the past. In fact, I copied and pasted the code posted a few months back regarding how to introduce an ID column and values into a shapefile. I am posting that code as well. Could you possibly verify that these methods are indeed working properly? I am passing all string values. I'm not sure why it says the input double value is out of range for id.
Error
System.ArgumentOutOfRangeException was unhandled by user code
Message="The input double value is out of range.\r\nParameter name: id"
Source="MapSuiteCore"
ParamName="id"
StackTrace:
at ThinkGeo.MapSuite.Core.x6d719af406ea4c2c.x12e7df23649722cf(Double x86d4512e4c7d8814, String x34decc57f0820440, Double xaee3bf422e2fd725, x1acec04cd58c1af5 xa798986acdb65a29, Double xe21f77686f8b957e, x1acec04cd58c1af5 x495f4164830ffad5)
at ThinkGeo.MapSuite.Core.ShapeFileFeatureSource.UpdateDbfData(String id, String columnName, String value)
at Utility.BuildRecId(String shapeFileName, String recIdColumnName) in d:\Documents and Settings\bagrawal\My Documents\Visual Studio 2008\WebSites\RMMSGeo\Utility.aspx.cs:line 216
at Utility.ProcessSTR_Click(Object sender, EventArgs e) in d:\Documents and Settings\bagrawal\My Documents\Visual Studio 2008\WebSites\RMMSGeo\Utility.aspx.cs:line 130
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
Sample Code
private void BuildRecId(string shapeFileName, string recIdColumnName) { ShapeFileFeatureSource featureSource = null; try { // Open the shape file featureSource = new ShapeFileFeatureSource(@shapeFileName, ShapeFileReadWriteMode.ReadWrite); featureSource.Open(); // Check to see if the RecId column exists Collection<featuresourcecolumn> columns = featureSource.GetColumns(); bool foundRecIdColumn = false; foreach (FeatureSourceColumn column in columns) { if (string.Compare(column.ColumnName, recIdColumnName, true) == 0) { foundRecIdColumn = true; break; } } // If the RecId column is not found then we need to add it. if (!foundRecIdColumn) { featureSource.AddColumnInteger(recIdColumnName.ToUpperInvariant(), 7); } // Loop through all of the records and update RecId column int recordCount = featureSource.GetCount(); for (int i = 0; i < recordCount; i++) { featureSource.UpdateDbfData(i.ToString(), recIdColumnName.ToUpperInvariant(), (i + 1).ToString()); } } finally { if (featureSource != null && featureSource.IsOpen) { featureSource.Close(); } } }
Thank you,
Binu