Money datatype and DBNull.Value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there

I have a column of type Money in a database table, the column is not mandatory and so allows nulls...in my code when i try to insert into that table, i check if the user has entered a value for the money column and if not, i pass in a sqlparameter with a value of DBNull.Value

However, i get a "implicit conversion from data type nvarchar to money" error when i try to pass DBNull.Value in. So..

...Why is it that I can't pass DBNull.Value to a column of type Money which allows nulls in SQL Server

...And if i can't do this, what am i suppossed to pass in the place of DBNull.Value

Cheers
 
Are you using the SQL provider?

Are you using an SP or an insert statement?

Your command parameter needs to have a type of SQLDBType.Money or
Decimal with a size of 8
 
Back
Top