0

Not sure Why I get the unhandled exception mentioned above. If this is executed with a number in the textbox, its fine, but any alpha character, and it throws the exception.

Dim Unumber As String = TextBox_U_Number.Text
            Dim con As OleDb.OleDbConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\SCHED_ASSIGN;Extended Properties='text;HDR=Yes;FMT=CSVDelimited'")
            Dim command As OleDb.OleDbCommand = con.CreateCommand()
            command.CommandText = "SELECT SCHED FROM SCHED_ASSIGN.csv WHERE UNUM = @UNUM"
            command.Parameters.AddWithValue("@unum", Unumber)
            con.Open()
            Dim RunSchedule As Object
            RunSchedule = command.ExecuteScalar()
            con.Close()
            If Not RunSchedule Is Nothing Then
                NumericUpDown_Use_Schedule.Value = RunSchedule.ToString
                Use_Schedule_Data(0) = NumericUpDown_Use_Schedule.Value
                Label_Log_Status.Text = "UNUMBER DOWNLOADING"
                ToolStripButton_Download_Click(Nothing, EventArgs.Empty)
            Else
                MsgBox("There is no Schedule assigned to this U number, please re-enter", MsgBoxStyle.OkOnly)
                GoTo 200
            End If
Siddique Mahsud
  • 1,453
  • 11
  • 21

0 Answers0