Advertisement

10.10.2007 at 11:04AM PDT, ID: 22884893
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

SQL UPDATE Command causes Arithmetic Overflow error converting numeric to datatype numeric

Asked by WesGoad in MS SQL Server, VB Database Programming

Tags: , , , ,

While using an SQL statement to update a database, a NULL value will not update and causes an  Arithmetic Overflow error converting numeric to datatype numeric. How do I stop this from occurring? Below is an example update string used to update the DB. The P_Reading value can occasionally be a Zero or NULL. This is when the error occurs. The Sql Column is Numeric with precision of 5 and a scale of 5.

Dim UpdateAll As String = "UPDATE P_Data " & _
                                        "SET d_ID = " & d_IDVal & ", " & _
                                        "pc_No = " & pc_noVal & ", " & _
                                        "P_Chamber = '" & P_ChamberVal & "', " & _
                                        "P_Reading = '" & p_ReadingVal & "', " & _
                                        "Comment = '" & Commenttext & "', " & _
                                        "Complete = " & ComplVal & "  " & _
                                        "WHERE P_ID = " & P_val & " "
                Try
                    SqlConnection1.Open()
                    Dim Update As New SqlCommand(UpdateAll, SqlConnection1) ' Add a record
                    UpdateSuccess = Update.ExecuteNonQuery
                    SqlConnection1.Close()
                    If UpdateSuccess <= 0 Then
                        MessageBox.Show("The attempt to Update Failed!")
                    End If
                Catch SQLExp As SqlException
                    MsgBox(SQLExp.Message, MsgBoxStyle.Critical, "SQL Error")
                    SqlConnection1.Close()
                Catch GenExp As Exception
                    MsgBox(GenExp.Message, MsgBoxStyle.Critical, "General Error")
                    SqlConnection1.Close()
                End TryStart Free Trial
[+][-]10.10.2007 at 11:10AM PDT, ID: 20050849

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.10.2007 at 11:22AM PDT, ID: 20050965

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.25.2007 at 05:27AM PDT, ID: 20146874

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, VB Database Programming
Tags: sql, update, overflow, arithmetic, command
Sign Up Now!
Solution Provided By: WesGoad
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628