I will include the code so you can see what I am talking about at the end. I have a vb.net 2008 app that I am writing. Everything seems to go fine until I add/edit/delete a record. I am getting the following error: Arithmetic Operation resulted in an overflow. If I ignore the error everything runs as I expect it to. However, I cannot have an application with an error. To give you a better idea of what is going on, I will give an example. My app allows me to select a client and choose a product that the client offers. After choosing the product I am taken to a screen that will allow me to add/delete/edit the images and image info for that product. The data is displayed using a datagridview. At first I thought it might be a timestamp issue, but I am getting this error even when doing a simple delete. Below is the code where the error occurs.
If conn.State = ConnectionState.Open Then
'create new command variable
Dim cmdDelete As New OdbcCommand
Dim x As Integer
cmdDelete = conn.CreateCommand
'set the command text to the sql delete statement
cmdDelete.CommandText = "DELETE FROM " & companyInfo & ".ORPMIMGX WHERE " & companyInfo & ".ORPMIMGX.ORIMGNAME LIKE '" & imgName.Trim() & "'"
'executes the delete command
x = cmdDelete.ExecuteNonQuery()
pbImage.Image = Nothing
'deletes the image from the server
IO.File.Delete(tbImageLocation.Text & imgName)
'reloads the datagridview with the new data
Catch ex As Exception
'If there is an error above, display the error message
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
If there is a better way for me to do this I am all ears. I just have to get this taken care off asap. I appreciate any help I can get on this. Thanks!
Visual Studios 2008, AS400 v7r1
April 25, 2012 4:44 PM
May 16, 2012 11:23 AM