VB+ACCESS,MSHFlexGrid表格数据修改后保存到数据库!

2024-12-29 06:55:26
推荐回答(2个)
回答1:

 

 

For i = 1 To .Rows - 1

dim s as integer,s1 as integer

s=.TextMatrix(i, 2)

s1=s=.TextMatrix(i, 2)

sqltext = "update ckc set 货号= " & s & " where id1= " & s1 & ""

Set rs = ExecuteSQL(sqltext, MsgString)

Next i

'建议更新完成后在刷新下mshflex表

rs.open "select * from ckc ",1,3

set .datasource=rs '重新加载mshflex表

MsgBox "数据保存完成", vbInformation, "提示

回答2:

sqltext="update ckc set 货号='"& .textmatrix(i,2) & "' where id1=" & .textmatrix(i,1)