把记录显示在文本框里,点击按钮显示下一条,为什么我的代码只显示第一条,请大神帮我看看,急急急!!
PrivateSubCommand1_Click()Adodc1.ConnectionString="provider=microsoft.jet.oledb.4.0;d...
Private Sub Command1_Click()
Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source = " & App.Path & "\db.mdb;"
Adodc1.RecordSource = "select * from title"
Adodc1.Refresh
If Not Adodc1.Recordset.EOF Then
Text1.Text = Adodc1.Recordset("tid")
Adodc1.Recordset.MoveNext
End If
End Sub 展开
Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source = " & App.Path & "\db.mdb;"
Adodc1.RecordSource = "select * from title"
Adodc1.Refresh
If Not Adodc1.Recordset.EOF Then
Text1.Text = Adodc1.Recordset("tid")
Adodc1.Recordset.MoveNext
End If
End Sub 展开
1个回答
展开全部
把前面三行代码放到form_load 里,就留下面代码
Private Sub Command1_Click()
If Not Adodc1.Recordset.EOF Then
Text1.Text = Adodc1.Recordset("tid")
Adodc1.Recordset.MoveNext
End If
End Sub
Private Sub Command1_Click()
If Not Adodc1.Recordset.EOF Then
Text1.Text = Adodc1.Recordset("tid")
Adodc1.Recordset.MoveNext
End If
End Sub
追问
为什么会这样 ? 大神求指教!
追答
因为你每次都重新执行这一句Adodc1.RecordSource = "select * from title",所以每次都从第一条开始。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询