SQLDbType Error. Need quick solution please.

  • Thread starter Thread starter Robert Bouillon
  • Start date Start date
R

Robert Bouillon

I'm using abstract interfaces to implement my business solution, and can't
seem to find a way to pass SmallMoney to my stored procedure without casting
up to a SqlDataParameter.

I've tried DbType.Decimal, DbType.Currency, and DbType.Double.

conn.Open();
cmd = conn.CreateCommand();
cmd.CommandText = "MyProc";
cmd.CommandType = CommandType.StoredProcedure;

{...}

IDataParameter pqty = cmd.CreateParameter();
pqty.ParameterName = "@Quantity";
pqty.DbType = DbType.Currenccy;

{...}

cmd.Parameters.Add(pqty);

s.Add(ppolldate);
cmd.Prepare();

{...}

cmd.ExecuteNonQuery(); //<-- Code breaks here.

I get the infamous System Error with the following Inner Exception:

"Error converting data type money to smallmoney."

Please Help. Thanks.

--ROBERT
 
SmallMoney likes the Currency DbType, however the value was too large to
store in a SmallMoney, so it was assumed a Money datatype.

It would be nice if the exception was a little more descriptive...

--ROBERT
 
Back
Top