I have a legacy solution written in VB.NET. It writes to a DB2 database using ODBC. I have a Textbox that is filled with a numeric value then I use ToString
in order to cast whatever is written there and write it to the database using ExecuteNonQuery since there the field is of CHAR(10) type, the problem that it yields Arithmetic operation resulted in an overflow
when compiling using AnyCPU
but it does not happen when compiling in 32 bits.
What is causing this since I am using it as a String?
Edit:
Public Sub ExecuteTransaction(ByVal connectionString As String)
Using connection As New OdbcConnection(connectionString)
Dim command As New OdbcCommand()
command.Connection = connection
Try
connection.Open()
command.Connection = connection
command.CommandText = "Update QS36f.table set Cat= 'F' where Num= '" & Me.txt2.ToString.Trim &"'"
command.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Using
End Sub