数据库记录更新时列名能不能是变量呢?
UPDATE XX SET XM1 = '" & Trim(Label65(0).Caption) & "' WHERE YY = MM这句里面的XM1是数据库中的一个列名,怎样实现变量化呢,因为列名里还有XM2,XM3,XM4....
从而实现
Dim i As Integer
for i = 0 to 10
UPDATE XX SET (XM i) = '" & Trim(Label65(0).Caption) & "' WHERE YY = MM
next i
这样的循环呢? Dim i As Integer
for i = 0 to 10
UPDATE XX SET XM" & i & " = '" & Trim(Label65(0).Caption) & "' WHERE YY = MM
next i
Dim i As Integer
for i = 0 to 10
strSql = "UPDATE XX SET XM" & i & " = '" & Trim(Label65(0).Caption) & "' WHERE YY = MM "
next i
补充:VB , 数据库(包含打印,安装,报表)