怎么这么奇怪,请高手回答~~
sql="select count(" & Pk & ") as c from " & table & " " & Condition
其中,Pk="a.Pid",table="Province a",Condition="where 1=1 and a.Plevel=1"。
set rs=conn.execute(sql)
报错:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]列前缀 'a' 与查询中所用的表名或别名不匹配。
输出sql语句是:
select count(a.Pid) as c from Province a where 1=1 and a.Plevel=1
那好,我把这个sql语句直接赋值:
sql="select count(a.Pid) as c from Province a where 1=1 and a.Plevel=1"
再次set rs=conn.execute(sql),正常。。。。
同时,查询分析器查询正常。
请高手回答~~谢谢。急