[此贴子已经被作者于2007-6-26 15:14:45编辑过]
[此贴子已经被作者于2007-6-26 15:14:45编辑过]
继续求助
sub 添加记录()
Call CNN_OPEN '连接数据库
Dim RST As New ADODB.Recordset
SQL = "Select * From 科目表"
RST.Open SQL, CNN, adOpenKeyset, adLockOptimistic
For LRow = 1 To MSFlexGrid1.Rows - 1
RST.AddNew
Form1.MSFlexGrid1.Row = LRow
RST.Fields("类型") = MSFlexGrid1.TextMatrix(LRow, 1)
RST.Fields("科目编码") = MSFlexGrid1.TextMatrix(LRow, 2)
RST.Fields("总账科目") = MSFlexGrid1.TextMatrix(LRow, 3)
RST.Fields("明细科目") = MSFlexGrid1.TextMatrix(LRow, 4)
RST.Fields("方向") = MSFlexGrid1.TextMatrix(LRow, 5)
RST.Fields("期初金额") = MSFlexGrid1.TextMatrix(LRow, 6)
RST.Update
Next LRow
MsgBox "数据记录添加成功!", vbInformation, ""
RST.Close: Set RST = Nothing
CNN.Close: Set CNN = Nothing
End Sub
[attach]23144[/attach]
[此贴子已经被作者于2007-6-26 15:15:47编辑过]