vb6.0 如何将vsflexgrid里的数据 保存到ACCESS 5
如题,:vb6.0如何将vsflexgrid里的数据保存到ACCESS那种一条一条的保存速度太慢了,有没有比较快速的,就像vsflexgrid整体读取ACCESS的数据一...
如题,:vb6.0 如何将vsflexgrid里的数据 保存到ACCESS
那种一条一条的保存速度太慢了,有没有比较快速的,就像vsflexgrid整体读取ACCESS的数据一样?
谢谢! 展开
那种一条一条的保存速度太慢了,有没有比较快速的,就像vsflexgrid整体读取ACCESS的数据一样?
谢谢! 展开
2个回答
展开全部
有啊,遍历vsflexgrid表里的所有数据,用for .... next 保存就行
我用的是mshflexgrid控件
For i = 1 To MSHFlexGrid2.Rows - 1 rs.Open "select * from sqlymdd where 合同编号='" + MSHFlexGrid2.TextMatrix(i, 1) + "'", cn, adOpenKeyset, adLockOptimistic If rs.RecordCount > 0 Then' MsgBox "该订单已存在", vbInformation, "" ddds = Val(MSHFlexGrid2.TextMatrix(i, 5)) dcds = Val(MSHFlexGrid2.TextMatrix(i, 6)) jyds = Val(MSHFlexGrid2.TextMatrix(i, 7)) rdds = Val(MSHFlexGrid2.TextMatrix(i, 8))' Set rs2 = cn.Execute("update sqlymdd set 订单吨数=" & ddds & ",调出吨数='" + MSHFlexGrid2.TextMatrix(i, 6) + "',结余吨数='" + MSHFlexGrid1.TextMatrix(i, 7) + "',日出货量='" + MSHFlexGrid2.TextMatrix(i, 8) + "',承运开始时间='" + MSHFlexGrid2.TextMatrix(i, 9) + "',承运结束时间='" + MSHFlexGrid2.TextMatrix(i, 10) + "',财务审核='" + MSHFlexGrid2.TextMatrix(i, 11) + "',销售审核='" + MSHFlexGrid2.TextMatrix(i, 12) + "',下单人='" + MSHFlexGrid2.TextMatrix(i, 13) + "' where 合同编号='" + MSHFlexGrid2.TextMatrix(i, 1) + "'") Set rs2 = cn.Execute("update sqlymdd set 订单吨数=" & ddds & ",调出吨数=" & dcds & ",结余吨数=" & jyds & ",日出货量=" & rdds & ",承运开始时间='" + MSHFlexGrid2.TextMatrix(i, 9) + "',承运结束时间='" + MSHFlexGrid2.TextMatrix(i, 10) + "',财务审核='" + MSHFlexGrid2.TextMatrix(i, 11) + "',销售审核='" + MSHFlexGrid2.TextMatrix(i, 12) + "',下单人='" + MSHFlexGrid2.TextMatrix(i, 13) + "' where 合同编号='" + MSHFlexGrid2.TextMatrix(i, 1) + "'") Else ddds = Val(MSHFlexGrid2.TextMatrix(i, 5)) dcds = Val(MSHFlexGrid2.TextMatrix(i, 6)) jyds = Val(MSHFlexGrid2.TextMatrix(i, 7)) rdds = Val(MSHFlexGrid2.TextMatrix(i, 8)) Set rs2 = cn.Execute("insert into sqlymdd(合同编号,购货单位,发货单位,品名规格,订单吨数,调出吨数,结余吨数,日出货量,承运开始时间,承运结束时间,财务审核,销售审核,下单人) values('" + MSHFlexGrid2.TextMatrix(i, 1) + "','" + MSHFlexGrid2.TextMatrix(i, 2) + "','" + MSHFlexGrid2.TextMatrix(i, 3) + "','" + MSHFlexGrid2.TextMatrix(i, 4) + "'," & ddds & "," & dcds & "," & jyds & "," & rdds & ",'" + MSHFlexGrid2.TextMatrix(i, 9) + "','" + MSHFlexGrid2.TextMatrix(i, 10) + "','" + MSHFlexGrid2.TextMatrix(i, 11) + "','" + MSHFlexGrid2.TextMatrix(i, 12) + "','" + MSHFlexGrid2.TextMatrix(i, 13) + "')") End If rs.Close
我用的是mshflexgrid控件
For i = 1 To MSHFlexGrid2.Rows - 1 rs.Open "select * from sqlymdd where 合同编号='" + MSHFlexGrid2.TextMatrix(i, 1) + "'", cn, adOpenKeyset, adLockOptimistic If rs.RecordCount > 0 Then' MsgBox "该订单已存在", vbInformation, "" ddds = Val(MSHFlexGrid2.TextMatrix(i, 5)) dcds = Val(MSHFlexGrid2.TextMatrix(i, 6)) jyds = Val(MSHFlexGrid2.TextMatrix(i, 7)) rdds = Val(MSHFlexGrid2.TextMatrix(i, 8))' Set rs2 = cn.Execute("update sqlymdd set 订单吨数=" & ddds & ",调出吨数='" + MSHFlexGrid2.TextMatrix(i, 6) + "',结余吨数='" + MSHFlexGrid1.TextMatrix(i, 7) + "',日出货量='" + MSHFlexGrid2.TextMatrix(i, 8) + "',承运开始时间='" + MSHFlexGrid2.TextMatrix(i, 9) + "',承运结束时间='" + MSHFlexGrid2.TextMatrix(i, 10) + "',财务审核='" + MSHFlexGrid2.TextMatrix(i, 11) + "',销售审核='" + MSHFlexGrid2.TextMatrix(i, 12) + "',下单人='" + MSHFlexGrid2.TextMatrix(i, 13) + "' where 合同编号='" + MSHFlexGrid2.TextMatrix(i, 1) + "'") Set rs2 = cn.Execute("update sqlymdd set 订单吨数=" & ddds & ",调出吨数=" & dcds & ",结余吨数=" & jyds & ",日出货量=" & rdds & ",承运开始时间='" + MSHFlexGrid2.TextMatrix(i, 9) + "',承运结束时间='" + MSHFlexGrid2.TextMatrix(i, 10) + "',财务审核='" + MSHFlexGrid2.TextMatrix(i, 11) + "',销售审核='" + MSHFlexGrid2.TextMatrix(i, 12) + "',下单人='" + MSHFlexGrid2.TextMatrix(i, 13) + "' where 合同编号='" + MSHFlexGrid2.TextMatrix(i, 1) + "'") Else ddds = Val(MSHFlexGrid2.TextMatrix(i, 5)) dcds = Val(MSHFlexGrid2.TextMatrix(i, 6)) jyds = Val(MSHFlexGrid2.TextMatrix(i, 7)) rdds = Val(MSHFlexGrid2.TextMatrix(i, 8)) Set rs2 = cn.Execute("insert into sqlymdd(合同编号,购货单位,发货单位,品名规格,订单吨数,调出吨数,结余吨数,日出货量,承运开始时间,承运结束时间,财务审核,销售审核,下单人) values('" + MSHFlexGrid2.TextMatrix(i, 1) + "','" + MSHFlexGrid2.TextMatrix(i, 2) + "','" + MSHFlexGrid2.TextMatrix(i, 3) + "','" + MSHFlexGrid2.TextMatrix(i, 4) + "'," & ddds & "," & dcds & "," & jyds & "," & rdds & ",'" + MSHFlexGrid2.TextMatrix(i, 9) + "','" + MSHFlexGrid2.TextMatrix(i, 10) + "','" + MSHFlexGrid2.TextMatrix(i, 11) + "','" + MSHFlexGrid2.TextMatrix(i, 12) + "','" + MSHFlexGrid2.TextMatrix(i, 13) + "')") End If rs.Close
更多追问追答
追问
有没有其它更快的方法?这个也比较慢
追答
你怎么感觉出来的,数据量多吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2014-01-11
展开全部
阿斯顿发射的发放的分割
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询