Updating a money column in SQL Server 2000

mike55

Well-known member
Joined
Mar 26, 2004
Messages
726
Location
Ireland
Hi all

Here is my statement:
Code:
 Dim credit As Decimal
 Dim price As Decimal
 Dim cncon As New SqlConnection(clsConnection.osqlStr)
 Dim commSQL As New SqlClient.SqlCommand
 cncon.Open()

 Try
    commSQL.Connection = cncon
    commSQL.CommandType = CommandType.Text
    commSQL.CommandText = "Select Credit from SMS_Credit where Org_ID = " + organization + ""
    credit = commSQL.ExecuteScalar
    commSQL.CommandText = Nothing

    If operation = 1 Then      Deduct the price of a SMS Message.
       price = credit - rate
       commSQL.CommandText = "Update SMS_Credit Set Credit = " + price + " where Org_ID = " + organization + ""
    ElseIf operation = 2 Then        Refund the price of a SMS Message.
       price = credit + rate
       commSQL.CommandText = "Update SMS_Credit Set Credit = " + price + " where Org_ID = " + organization + ""
    End If
 commSQL.ExecuteNonQuery()

Am getting an exception telling me that the cast to from string to type double is not valid

Mike55
 
Back
Top