Private Sub Command1_Click() ' delete current line
adoRecordset.Delete adAffectCurrent
End Sub
Private Sub Command2_Click() 'add new line
adoRecordset.AddNew
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 2 '为 DataGrid 添加三列
adoRecordset.Fields.Append "第" & i & "列", adVariant, , adFldMayBeNull + adFldIsNullable + adFldUpdatable
Next i
adoRecordset.Open
For i = 0 To 9
adoRecordset.AddNew '为 DataGrid 添加十空行
Next i
Set DataGrid1.DataSource = adoRecordset '绑定 DataGrid 的数据源
adoRecordset.MoveFirst
End Sub