路径变量是全局定义的。 读者对象使用项目(0)后,无法访问er.item(0),er.item(1),er.item(2),er.item(2),er.item(3)的值。有什么问题?
这是代码
Private Sub load_qc_by()
Dim dname = CategoryDropDown2.Text
con.ConnectionString = path
cmd.Connection = con
con.Open()
cmd.CommandText = "SELECT SQC_By,PQC_By,FQC_By,CQC_By FROM Deliverables WHERE Deliverable ='" & dname & "' AND Project='" & ProjectDropDown2.Text & "'"
Dim er As OleDbDataReader = cmd.ExecuteReader
If er.HasRows Then
While er.Read
If (er.Item(0).ToString.Equals("NA")) Then
Call load_all_Names("sqcby_combobox")
sqcby_combobox.SelectedIndex = 0
Else
MessageBox.Show(er.Item(0))
sqcby_combobox.Text = er.Item(0).ToString
sqcby_combobox.Enabled = False
End If
If (er.Item(1).ToString.Equals("NA")) Then
Call load_all_Names("pqcby_combobox")
pqcby_combobox.SelectedIndex = 0
Else
MessageBox.Show(er.Item(1))
pqcby_combobox.Text = er.Item(1)
pqcby_combobox.Enabled = False
End If
If (er.Item(2).ToString.Equals("NA")) Then
Call load_all_Names("fqcby_combobox")
fqcby_combobox.SelectedIndex = 0
Else
MessageBox.Show(er.Item(2))
fqcby_combobox.Text = er.Item(2)
fqcby_combobox.Enabled = False
End If
If (er.Item(3).ToString.Equals("NA")) Then
Call load_all_Names("cqcby_combobox")
cqcby_combobox.SelectedIndex = 0
Else
MessageBox.Show(er.Item(3))
cqcby_combobox.Text = er.Item(3)
cqcby_combobox.Enabled = False
End If
End While
End If
er.Close()
con.Close()
End Sub