呵呵,有意思 我给个用ADO对象的例子吧 dim cnn as new adodb.connection dim rst as new adodb.recordset cnn.open "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=" & App.Path & "\db.mdb;" _ & "Persist Security Info=False" rst.open "select * from tablename where fieldname=**",cnn,adopenstatic, adLockBatchOptimistic '如果要显示第3条记录 rst.move 3,1 me.text1.text=rst.fields("fieldname")
Dim INTRST As Integer INTRST = 0For I = 1 To ? ?是你要显示的第?条记录 MYRST.MoveNext 'MYRST是你的记录集 INTRST = INTRST + 1 'INTRST是共 Next IMsgBox (MYRST.Fields(*) & " " & INTRST) VB好像没有指针一类的东东,也许还有更好的办法吧
我不是要加入查询语句而是要在VB中加入代码
如果不用SQL的话,可用Field属性,不过我还是建议用SQL语句!
在网上都都找不到VB数据库的基础资料
不然一会又一个人进来说:我认为****比较好,那这个问题就等于没人回答了
我给个用ADO对象的例子吧
dim cnn as new adodb.connection
dim rst as new adodb.recordset
cnn.open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & App.Path & "\db.mdb;" _
& "Persist Security Info=False"
rst.open "select * from tablename where fieldname=**",cnn,adopenstatic,
adLockBatchOptimistic
'如果要显示第3条记录
rst.move 3,1
me.text1.text=rst.fields("fieldname")
INTRST = 0For I = 1 To ? ?是你要显示的第?条记录
MYRST.MoveNext 'MYRST是你的记录集
INTRST = INTRST + 1 'INTRST是共
Next IMsgBox (MYRST.Fields(*) & " " & INTRST)
VB好像没有指针一类的东东,也许还有更好的办法吧