teixeira
Well-known member
Hi
Ive a table in my SQL SERVER 2005 Express database with a couple of columns with decimal(4,2) data type, but when i try to insert a value on it, using the following stored procedure, i get this error: "Arithmetic overflow error converting numeric to data type numeric.", its a kinda strange because the input value is ok, i think.
So heres the SP:
Ive a table in my SQL SERVER 2005 Express database with a couple of columns with decimal(4,2) data type, but when i try to insert a value on it, using the following stored procedure, i get this error: "Arithmetic overflow error converting numeric to data type numeric.", its a kinda strange because the input value is ok, i think.
So heres the SP:
Code:
using (SqlCommand cmd = new SqlCommand())
{
decimal qt = decimal.parse(qttTextBox.Text);
cmd.Connection = DataBase.Conn;//Cria connection se n existir automaticamente
cmd.CommandText = "spCriarLinhasPrescricao";
cmd.CommandType = CommandType.StoredProcedure;
//Parametros SP
cmd.Parameters.Clear();
cmd.Parameters.Add("@idMedicamento", SqlDbType.Int).Value = medicamentoId;
cmd.Parameters.Add("@idPaciente", SqlDbType.Int).Value = pacienteId;
cmd.Parameters.Add("@quant", SqlDbType.Decimal).Value = qt; //Here comes the error
//Abre Conex