numeric conversion error need your help

A

al

Dim dbParam_amount As System.Data.IDataParameter = New
System.Data.SqlClient.SqlParameter
dbParam_amount.ParameterName = "@amount"
dbParam_amount.Value = amount.text
dbParam_amount.DbType = System.Data.DbType.numeric [??]
dbCommand.Parameters.Add(dbParam_amount)

hi, I am gettting an error when I update a table that
contain a field amount with datatype of numeric(18,4)

I have tried different ways to correct it, it does only
work when I change the table field datatype to varchar and
dbParam_amount.DbType = System.Data.DbType.String

This tells me that I am having issue using Datatype in the
update process.
I would appreciate your help to guide me to a solution.
I want to keep having numerice(18,4) as a datatype for the
field amount in the table,
so in the code what do I need to do in order to make the
update process wrok.
thanks
Al
 
N

Natty Gur

Hi,

Create Parameter object and set:

oParam.DBType = Decimal;
oParam.Percision = 18;
oParam.Ccale = 4;

add that parameter to the command parameters.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top