有关SQL SERVER语句的问题 0x800A03EA 语法错误

发布网友 发布时间:2024-10-24 03:38

我来回答

3个回答

热心网友 时间:2024-11-09 17:55

sSql = "SELECT UseSteamMasterData.User_code, UsersInfo.User_name, UseSteamMasterData.Update_time, UseSteamMasterData.Temp_value, UseSteamMasterData.Press_value, UseSteamMasterData.Quantity_value, UseSteamMasterData.TQuantity_value" & _
" FROM UsersInfo, UseSteamMasterData" & _
" WHERE UsersInfo.User_code = UseSteamMasterData.User_code ORDER BY UsersInfo.User_code"

看出来我改了哪里了吗?看不出来没关系,把它复制到你的程序里试试。
作为建议,你的语句最好改成下面的样子,否则你写起来费劲,大家看着也累:
sSql = "SELECT A.User_code, B.User_name, A.Update_time, A.Temp_value, A.Press_value, A.Quantity_value, A.TQuantity_value" & _
" FROM UsersInfo B, UseSteamMasterData A" & _
" WHERE B.User_code = A.User_code ORDER BY B.User_code"

热心网友 时间:2024-11-09 17:58

sSql = "SELECT UseSteamMasterData.User_code, UsersInfo.User_name, UseSteamMasterData.Update_time, UseSteamMasterData.Temp_value, UseSteamMasterData.Press_value, UseSteamMasterData.Quantity_value, UseSteamMasterData.TQuantity_value FROM UsersInfo, UseSteamMasterData WHERE UsersInfo.User_code = UseSteamMasterData.User_code ORDER BY UsersInfo.User_code"

如果这样也错的话,哪就是你的表名在哪里写错啦!

热心网友 时间:2024-11-09 17:54

ORDER BY UsersInfo.User_code
这句话按UsersInfo.User_code进行排序,但是你的【select选择列】里面【没有这个字段】当然会出错啦。你把UsersInfo.User_code加到select里面试试,不行再补充.

你尝试先把SQL语句打印出来看看是否格式正确,有时候就因为那么个空格或全角字符搞得头大的。

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com