0

不确定为什么我会收到上面提到的未处理异常。如果这是用文本框中的数字执行的,它很好,但是任何字母字符,它都会抛出异常。

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
4

0 回答 0