Hello All,
I am facing a huge problem ,I am opening a DBF file .For some cases it is fine but few tables its giving errors like:-
"the Provider couldnot determine the Decimal value.For Example, the row was just created,the default for the Decimal column was not
available,and the consumer had not yet set a Decimal value"
Code snippet is :-
public DataSet GetProjectTable()
{
string strSql,strConnect;
try
{
strConnect="User ID=;DSN=;Collating Sequence=MACHINE;Data Source= '" + ngisViewer_Open.lay + "'
![](https://www.codeproject.com/script/images/smiley_tongue.gif)
rovider=VFPOLEDB.1;Cache Authentication=False;Mask Password=False;persist security info=False;Mode=Share Deny None;Extended Properties=;Encrypt Password=False";
OleDbConnection objConn = new OleDbConnection();
OleDbDataAdapter objDA= new OleDbDataAdapter();
OleDbDataAdapter objDA1= new OleDbDataAdapter();
OleDbCommand objCmd = new OleDbCommand();
objConn.ConnectionString = strConnect;
objConn.Open();
strSql = "select * from '" + ngisViewer_Open.lay_Name_Final + "' ";
objCmd.CommandText = strSql;
objCmd.Connection = objConn;
objDA.SelectCommand = objCmd;
DataColumn dc = new DataColumn("UID", typeof(int));
objDA.Fill(ds1,"MyTable");
ds1.Tables["MyTable"].Columns.Add(dc);
for(int j=0;j
{
ds1.Tables["MyTable"].Rows[j]["UID"]=j+1;
}
ds1.AcceptChanges();
objConn.Close();
}
catch( Exception ex)
{
String msg = ex.Message + ". Check the path." + " Already Open ";
MessageBox.Show(msg, "Validation",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
return (ds1);
}
Anil Dhiman
GIS Engineer