Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset cnn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=kaoping;Data Source=192.168.1.3"
Dim tot(1 To 3) As Integer
Set rs = cnn.Execute("select * from diaocha where num=1")
tot(1) = rs.Fields("A") + SNum(1)
tot(2) = rs.Fields("B") + SNum(2)
tot(3) = rs.Fields("C") + SNum(3)
Set rs = cnn.Execute("update diaocha set A=" + Val(tot(1)) + ",B=" + Val(tot(2)) + ",C=" + Val(tot(3)) + " where Num=1")
sql表里A,B,C字段的类型都是int型的为什么执行最后一句的时候总是报实时错误(13),类型不匹配呢?哪位大侠帮帮我
Dim rs As New ADODB.Recordset cnn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=kaoping;Data Source=192.168.1.3"
Dim tot(1 To 3) As Integer
Set rs = cnn.Execute("select * from diaocha where num=1")
tot(1) = rs.Fields("A") + SNum(1)
tot(2) = rs.Fields("B") + SNum(2)
tot(3) = rs.Fields("C") + SNum(3)
Set rs = cnn.Execute("update diaocha set A=" + Val(tot(1)) + ",B=" + Val(tot(2)) + ",C=" + Val(tot(3)) + " where Num=1")
sql表里A,B,C字段的类型都是int型的为什么执行最后一句的时候总是报实时错误(13),类型不匹配呢?哪位大侠帮帮我
cnn.execute strsql
where num=1 就是对num为1的更新
where num between 1 10 就是对num为1至10的记录更新
这是表结构,用between不行啊,因为只有num是固定不变的,abc是根据投票累加的啊
1 0 0 0
2 0 0 0
3 0 0 0
4 0 0 0
5 0 0 0这是表结构
cnn.execute strsql