0

I am writing a database and need to post a value in a lable to a sql field.
the sql datatype is set to money.

when posting i have

CMD.Parameters.addwithValue("@Claim", LBCLAIM.text)

when posting i gett an error

cannot convert a char vaule to money. the char vaule has incorrect syntax.

please help

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Unhnd_Exception
0

You should be able to cast it to a double or decimal

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim Connection As New SqlServerCe.SqlCeConnection("Data Source=|DataDirectory|\Database1.sdf")
    Dim Command As New SqlServerCe.SqlCeCommand With {.Connection = Connection}

    Command.CommandText = "Insert Into Table1 (MoneyColumn) values(@MoneyColumn)"

    Command.Parameters.AddWithValue("@MoneyColumn", CDbl("$45.56"))

    Connection.Open()
    Command.ExecuteNonQuery()
    Connection.Close()
End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.