Private Sub CreateRecordset()
With rs
'建立rs的Table结构
.Fields.Append "ID", adInteger
.Fields.Append "Item", adBSTR, 255
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open '不需要连接物件。
End With
Dim i As Integer
'新增资料到Resultset中
For i = 1 To 100
rs.AddNew
rs!id = i
rs!Item = "thing " & i
rs.Update
Next i
rs.MoveFirst
Set MSHFlexGrid1.DataSource = rs
End Sub
Private Sub Command2_Click()
rs.MovePrevious
End Sub
Private Sub Command3_Click() '将recordset中的数据保存至表中
Open_Db
????????
Close_Db
End Sub
Private Sub Form_Load()
Command1.Caption = "MoveNext"
Command2.Caption = "MovePrevious"
Call CreateRecordset
'定义Text1 为DataBinding,资料来源是rs, 显示栏位是id
Set Text1.DataSource = rs
Text1.DataField = "id"
'定义Text1 为DataBinding,资料来源是rs, 显示栏位是Item
Set Text2.DataSource = rs
Text2.DataField = "Item"
End Sub
Private Sub Form_Unload(Cancel As Integer)
rs.Close
End Sub