Hi,

I have a textbox where I can enter a number. If the number exists in my sql database then it would change the label accordingly. It seems to work with any input number except for numbers starting with zero. If I input a number starting with zero(012345678) I get the error: Arithmetic Overflow error converting varchar to data type numeric. Please help. I need it to accept these kinds of numbers.

Code:
Imports System.Data.SqlClient
Public Class ValidateForm

    Private Sub MineralCloseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MineralCloseButton.Click
        Me.Close()
    End Sub
    Private Sub CheckButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckButton.Click
        Dim ParcelNo As String
        ParcelNo = ParcelNumberTextBox.Text
        Try
            cnn = SQLDBConnect()
            cnn.Open()
        Catch ex As Exception
            MessageBox.Show(Me, "SQL Connection Failed: " + ex.Message, "Communication Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            errorlog(ex.ToString)
            Exit Sub
        End Try
        Try
            Dim sqlresult As Integer
            Dim command0 As SqlClient.SqlCommand = New SqlClient.SqlCommand("Select count(*) from nw_sum where parcel_number =" & ParcelNo, cnn)
            command0.CommandType = CommandType.Text
            command0.CommandTimeout = 600
            command0.ExecuteScalar()
            sqlresult = command0.ExecuteScalar
            If sqlresult = 0 Then
                Label1.Text = "Yes"
            Else
                Label1.Text = "No"
            End If
        Catch ex As Exception
            MsgBox(ex.Message)

        End Try
        cnn.Close()
    End Sub
    'Error Log Subroutine to write errors into log files
    Public Sub errorlog(ByVal er)
        Dim FILE_NAME As String = "C:\Program Files\Noxious Weeds Report\ErrorLogs\NOXErrorlog.txt"
        If System.IO.File.Exists(FILE_NAME) = True Then
            Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
            objWriter.Write(vbNewLine & System.DateTime.Now & er)
            objWriter.Close()
        Else
            Dim objWriter As New System.IO.StreamWriter(FILE_NAME, False)
            objWriter.Write(vbNewLine & System.DateTime.Now & er)
            objWriter.Close()
        End If
    End Sub
End Class