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

Another premature post by Robert

Robert
Tue Sep 07 11:43:34 CDT 2004

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

"Robert Bouillon" <djwhizzard@hotmail.com> wrote in message
news:uzNE%23zOlEHA.2820@TK2MSFTNGP15.phx.gbl...
> 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
>
>