主题:一个数据库记录读取问题
我使用以下代码将一字段添加到COMBOBOX里
Dim conn1 As New OleDbConnection
Dim strString As String
Dim cmd1 As OleDbCommand
Dim s1 As String
Dim dr1 As OleDbDataReader
strString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db.mdb;"
conn1 = New OleDbConnection(strString)
conn1.Open()
s1 = "select subname from subject"
cmd1 = New OleDbCommand(s1, conn1)
dr1 = cmd1.ExecuteReader
dr1.Read()
Do Until dr1.Read = False
ComboBox1.Items.Add(dr1(0))
Loop
dr1.Close()
conn1.Close()
但是,在comobox里面第一条记录没有读进去,不知道是哪儿出问题了?请各位看看!!!
Dim conn1 As New OleDbConnection
Dim strString As String
Dim cmd1 As OleDbCommand
Dim s1 As String
Dim dr1 As OleDbDataReader
strString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db.mdb;"
conn1 = New OleDbConnection(strString)
conn1.Open()
s1 = "select subname from subject"
cmd1 = New OleDbCommand(s1, conn1)
dr1 = cmd1.ExecuteReader
dr1.Read()
Do Until dr1.Read = False
ComboBox1.Items.Add(dr1(0))
Loop
dr1.Close()
conn1.Close()
但是,在comobox里面第一条记录没有读进去,不知道是哪儿出问题了?请各位看看!!!