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
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.
Your password has been sent to:email@example.com
To follow this tag...
Thanks! We'll email you when relevant content is added and updated.
Share this item with your network: