A
Andre Botelho
Hi there...
I am trying to update a dataset with a decimal value (precision 9,
scale 4).
This is the column in the XML file generated by the DataSet
<PERC_DESCONTO>23.0402</PERC_DESCONTO>
As you can see the value is 23.0402 but when I update this dataset the
exception "Parameter value '230402,0000' is out of range." is raised.
If I change the value to 23.04 it works fine. I am using
SqlCommandBuilder with SqlDataAdapter.
This is the code of the update method:
private bool UpdateDataSet(string TableName, DataSet dsUpdate,
SqlConnection Connection)
{
try
{
Connection.Open();
try
{
string CommandText = "SELECT * FROM " + TableName;
SqlDataAdapter Adapter = new SqlDataAdapter(CommandText,
Connection);
SqlCommandBuilder Builder = new SqlCommandBuilder(Adapter);
Adapter.RowUpdated += new
SqlRowUpdatedEventHandler(OnRowUpdated);
Adapter.Update(dsUpdate.Tables[0]);
return true;
}
finally
{
Connection.Close();
}
}
catch (Exception ex)
{
ErrorList.Append(ex.Message + Environment.NewLine +
ex.GetType().FullName);
return false;
}
}
Is this something about using commandbuilder? Maybe it's default scale
value is 2.
Thanks in advance for those who can help me...
Sorry for the poor english.
I am trying to update a dataset with a decimal value (precision 9,
scale 4).
This is the column in the XML file generated by the DataSet
<PERC_DESCONTO>23.0402</PERC_DESCONTO>
As you can see the value is 23.0402 but when I update this dataset the
exception "Parameter value '230402,0000' is out of range." is raised.
If I change the value to 23.04 it works fine. I am using
SqlCommandBuilder with SqlDataAdapter.
This is the code of the update method:
private bool UpdateDataSet(string TableName, DataSet dsUpdate,
SqlConnection Connection)
{
try
{
Connection.Open();
try
{
string CommandText = "SELECT * FROM " + TableName;
SqlDataAdapter Adapter = new SqlDataAdapter(CommandText,
Connection);
SqlCommandBuilder Builder = new SqlCommandBuilder(Adapter);
Adapter.RowUpdated += new
SqlRowUpdatedEventHandler(OnRowUpdated);
Adapter.Update(dsUpdate.Tables[0]);
return true;
}
finally
{
Connection.Close();
}
}
catch (Exception ex)
{
ErrorList.Append(ex.Message + Environment.NewLine +
ex.GetType().FullName);
return false;
}
}
Is this something about using commandbuilder? Maybe it's default scale
value is 2.
Thanks in advance for those who can help me...
Sorry for the poor english.