Simple conversion question.

G

Guest

Hello all!

I tried a few things, can't seem to figure out the right combination. here
the snippet of CODE
Dim cmdBet As SqlCommand
Dim ConWg As New SqlConnection
Try
ConWg = New
SqlConnection("Server=Localhost;uid=xx;pwd=xxxx;database=xxx")
cmdBet = New SqlCommand("PlBetII", ConWg)
cmdBet.CommandType = CommandType.StoredProcedure
'cmdBet.Parameters.Add("@Credits", SqlDbType.NVarChar).Value =
txbCredits.Text
cmdBet.Parameters.Add("@Wager", SqlDbType.Decimal).Value =
txbTotWage.Text
cmdBet.Parameters.Add("@UserID", SqlDbType.VarChar).Value =
txbTableIDm.Text
ConWg.Open()
cmdBet.ExecuteNonQuery()
ConWg.Close()
Catch ex As Exception
Label4.Text = ex.Message.ToString
End Try
The value in txbTotWage is like this "$6.00"
My SP PlBetII is good, and @wage is deciaml. I get this on Exception. "Input
string was not in correct format" I know that if I take the "$" away, it
should be fine, so how do I go about fixing this. SQL should take I thought.
When Itried to use Money in the SQL table, in my vb.net app, it says it's not
correct format. Any ideas?

TIA!!!

Rudy
 
G

Guest

Money is just a 64 bit fixed point number with four decimal places. It
carries no information on the currency used, so you have to strip away
the currency from the value.
 

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