先建一数据库表,用ado连接数据库: for i=1 to n1'行 for j=1 to n2'列 Dim cn1 As ADODB.Connection Dim rc1 As ADODB.Recordset Dim strcn As String strcn = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:\新建文件夹\yonghu.mdb" Set cn1 = New ADODB.Connection Set rc1 = New ADODB.Recordset cn1.Open strcn rc1.CursorType = adOpenKeyset rc1.LockType = adLockOptimistic rc1.Open "yonghu", cn1, , , adCmdTable rc1.addnew rc1!字段1=MSHFlexGrid1.TextMatrix(i, j) …… rc1.update rc1.Close cn1.Close next j next i
for i=1 to n1'行
for j=1 to n2'列
Dim cn1 As ADODB.Connection
Dim rc1 As ADODB.Recordset
Dim strcn As String
strcn = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:\新建文件夹\yonghu.mdb"
Set cn1 = New ADODB.Connection
Set rc1 = New ADODB.Recordset
cn1.Open strcn
rc1.CursorType = adOpenKeyset
rc1.LockType = adLockOptimistic
rc1.Open "yonghu", cn1, , , adCmdTable
rc1.addnew
rc1!字段1=MSHFlexGrid1.TextMatrix(i, j)
……
rc1.update
rc1.Close
cn1.Close
next j
next i