o While q <= i
a_1 = Format(CStr(nian.Text) + "-" + CStr(yue.Text) + "-" + CStr(q), "yyyy-mm-dd")
rsado.Open "select * from by where by1='" & CStr(a_1) & "'", cnado, adOpenDynamic, adLockOptimistic, -1
If (rsado.EOF = True) Then
rsado.Close
rsado.Open "select * from bb where A1='" & CStr(a_1) & "'", cnado, adOpenDynamic, adLockOptimistic, -1
If (rsado.EOF = False) Then
rsado.Close '累积流量取月累积值,其他取平均值 Set otmpRs = cnado.Execute("select avg(b3),avg(b4),avg(b5),avg(b6),avg(b7),avg(b8),avg(b9),(Max(b10) - min(b10)),avg(b11),avg(b12),avg(b13) ,avg(b14),avg(b15),avg(b16),avg(b17),avg(b18),avg(b19),avg(b20),avg(b21),avg(b22),avg(b23),avg(b24),avg(b25),avg(b26),avg(b27),avg(b28)from aa where a1='" & CStr(a_1) & "' ") cnado.Execute "insert into by (by1,by2,by3,by4,by5,by6,by7,by8,by9,by10,by11,by12,by13,by14,by15,by16,by17,by18,by19,by20,by21,by22,by23,by24,by25,by26,by27) values ('" & a_1 & "','" & Round(otmpRs.Fields(0), 4) & "','" & Round(otmpRs.Fields(1), 4) _ & "','" & Round(otmpRs.Fields(2), 4) & "','" & Round(otmpRs.Fields(3), 4) & "','" & Round(otmpRs.Fields(4), 4) & "','" & Round(otmpRs.Fields(5), 4) & "','" & Round(otmpRs.Fields(6), 4) _
& "','" & Round(otmpRs.Fields(7), 4) & "','" & Round(otmpRs.Fields(8), 4) & "','" & Round(otmpRs.Fields(9), 4) & "','" & Round(otmpRs.Fields(10), 4) & "','" & Round(otmpRs.Fields(11), 4) _
& "','" & Round(otmpRs.Fields(12), 4) & "','" & Round(otmpRs.Fields(13), 4) & "','" & Round(otmpRs.Fields(14), 4) & "','" & Round(otmpRs.Fields(15), 4) & "','" & Round(otmpRs.Fields(16), 4) _ & "','" & Round(otmpRs.Fields(17), 4) & "','" & Round(otmpRs.Fields(18), 4) & "','" & Round(otmpRs.Fields(19), 4) & "','" & Round(otmpRs.Fields(20), 4) _
& "','" & Round(otmpRs.Fields(21), 4) & "','" & Round(otmpRs.Fields(22), 4) & "','" & Round(otmpRs.Fields(23), 4) & "','" & Round(otmpRs.Fields(24), 4) & "','" & Round(otmpRs.Fields(25), 4) & "','" & Round(otmpRs.Fields(26), 4) & "')"
q = q + 1
Else
q = q + 1
rsado.Close
End If
Else
q = q + 1
rsado.Close
End If Loop
其中rsado.Open "select * from by where by1='" & CStr(a_1) & "'", cnado, adOpenDynamic, adLockOptimistic, -1报警,怎么回事呢,谁帮我弄一下,最好修改一下,我是个新手
vb open select 提示Form子句语法错误
答案:2 悬赏:50 手机版
解决时间 2021-02-14 22:18
- 提问者网友:戎马万世
- 2021-02-14 06:58
最佳答案
- 五星知识达人网友:一把行者刀
- 2021-02-14 08:21
by 是SQL关键字,最好不要用作表名或字段名,实在要用必须用方括号括起来,比如:
select * from [by] where by1= ...
SQL关键字,通俗来说就是SQL语句中用到的那些命令名,比如select、from、where、order、group、by等等,这些词如果不加标示就作为字段名或表名,会引起歧义的,比如
select select,by,order from from where where=order order by by;
别说电脑,就是你自己也看糊涂了是吧?
建议在给表或字段起名时,不要用简单的单个英文单词,可以用英文单词与数字或下划线结合,或者用汉语拼音,这样就不会无意中和某个关键词撞车了。也可以养成在字段名和表名加方括号的习惯,比如上面那个SQL语句改成这样就没问题:
select [select],[by],[order] from [from] where [where]=[order] order by [by];
select * from [by] where by1= ...
SQL关键字,通俗来说就是SQL语句中用到的那些命令名,比如select、from、where、order、group、by等等,这些词如果不加标示就作为字段名或表名,会引起歧义的,比如
select select,by,order from from where where=order order by by;
别说电脑,就是你自己也看糊涂了是吧?
建议在给表或字段起名时,不要用简单的单个英文单词,可以用英文单词与数字或下划线结合,或者用汉语拼音,这样就不会无意中和某个关键词撞车了。也可以养成在字段名和表名加方括号的习惯,比如上面那个SQL语句改成这样就没问题:
select [select],[by],[order] from [from] where [where]=[order] order by [by];
全部回答
- 1楼网友:野慌
- 2021-02-14 09:19
select * from 学籍表 where 性别 ="女"
sql语句如无意外,我印象中是这样的.
所以,
select * from 学籍表 where 性别 =女
有问题,可以试下改成如下
str="select * from 学籍表 where 性别 =" & chr("号的ascii码,我忘了,不好意思,百度有得查) & "女 " & chr(")
请大家多多指教.
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯