fsuedu
asked on
Visual Studio Visual Basic -Sql Update Statment
Trying to update some fields to a sql database 2005 in sub FormClosing of datatype numeric(10, 2)
with the code below:
Try
objConn.Open()
With colCmd
.CommandType = CommandType.Text
.CommandText = "Update Settlement Set PreviouAdvDepositstxt = '" & PreviouAdvDepositstxtTextB ox.Text & "', TransferGuestLedgertxt = '" & TransferGuestLedgertxt.Tex t & "', ActivityAdvdeposittxt = '" & Activityadvdeposittxt.Text & "'Where Sitetxt = 2 and PrimaryKey = (Select Max(PrimaryKey) from Settlement where SiteTxt=2)"
.Connection = objConn
.ExecuteNonQuery()
End With
objConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message )
End Try
Im getting a error message of: Error converting data type varchar to numeric.
It happens when the number is more then 4 spaces past the Decimal because the number has a comma in it for example 1,000.00- I need the comma to display, but also need to import it into the sql database.
Any ideas
with the code below:
Try
objConn.Open()
With colCmd
.CommandType = CommandType.Text
.CommandText = "Update Settlement Set PreviouAdvDepositstxt = '" & PreviouAdvDepositstxtTextB
.Connection = objConn
.ExecuteNonQuery()
End With
objConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message
End Try
Im getting a error message of: Error converting data type varchar to numeric.
It happens when the number is more then 4 spaces past the Decimal because the number has a comma in it for example 1,000.00- I need the comma to display, but also need to import it into the sql database.
Any ideas
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.