473,385 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Simple conversion question.

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;da tabase=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
May 14 '06 #1
1 1067
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.

Rudy wrote:
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;da tabase=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

May 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Newsgroup - Ann | last post by:
Hi, I got a question a tricky type conversion: double * ==> const double * and double ** ==> const double * const * are both permitted, while double ** ==> const double ** is NOT permitted. ...
1
by: Proteus | last post by:
Any help appreciated on a small perl project I need to write for educator/teaching purposes. I have not programmed perl for some time, need to get up to speed, maybe some kind souls hrere will help...
4
by: GRoll21 | last post by:
In this program, it is going to change a value in the array. So to give it it's new value I need to assign it the new value. It doesn't like the conversion. Here is the error. ...
31
by: Bjørn Augestad | last post by:
Below is a program which converts a double to an integer in two different ways, giving me two different values for the int. The basic expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
0
by: Rich | last post by:
(1) Is there a better place to pose the question below? (2) I am starting to convert my enterprise solution from VS 2003 (.NET v1.1.4322) to VS 2005 Professional (.NET v2.0.50727). The entire...
4
by: dba_222 | last post by:
Dear Experts, Ok, I hate to ask such a seemingly dumb question, but I've already spent far too much time on this. More that I would care to admit. In Sql server, how do I simply change a...
5
by: Alberto Salvati | last post by:
Hi, List. My company has a VERY BIG product base on db2 udb v7.x. We want to di an upgrade to v9, but.... current db has a lot of procedure (cobol..!). Therefore, we've planned to rewrite this...
7
by: Tony Johansson | last post by:
Hello! Why does not this cause a compile error because a ulong has never been implicitly convertible to byte? ulong vektor = {100000,200000,300000}; foreach(byte b in vektor) {...
32
by: alex.j.k2 | last post by:
Hello all, I have "PRECISION" defined in the preprocessor code and it could be int, float or double, but I do not know in the code what it is. Now if I want to assign zero to a "PRECISION"...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.