本文介绍了选择Qry:通过Access& amp;和ADO(& SQL Server)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有一个查询在Access查询构建器中生成不同的结果 和ASP页面(通过ADO) 查询示例是: ---------------------------------------- ------------------ 选择''Ranked''作为Source,H.HotelName,H.TelNo,H.URL,H.Location , H.HotelID,排名 来自(酒店H Inner加入PrefHotels P on H.HotelID = P.HotelID) 内部加入地点L on P.LocID = L.LocID 其中Rank不为空且Rank> 0和L.LocID = 2 联盟 选择''Unranked''作为Source,H.HotelName,H.TelNo,H .URL,H.Location, H.HotelID,Rank 来自(酒店H Inner加入PrefHotels P on H.HotelID = P.HotelID) 内部加入位置L在P.LocID上= L.LocID 其中(Rank为Null或Rank = 0)和L.LocID = 2 按来源排序,排名 ------------------------------------ ---------------------- 在Access中,我得到以下结果 排名,酒店1,[其他领域],1 排名,酒店2,[其他领域],2 排名,酒店3,[其他领域],3 未评级,酒店4,[其它领域],0 未评级,酒店4,[其他领域],0 未评级,酒店4,[其他字段],0 等... 在我的ASP页面中,我得到以下结果: 未评级,酒店1,[其它领域], 未评级,酒店2,[其它领域], 未评级,酒店3 ,[其它领域], 未评级,酒店4,[其它领域], 未评级,酒店4,[其它领域], 未评级, Hotel4,[其他领域], 等... 我已将Access DB导入SQL Server,并在查询分析器和 ASP页面我得到了正确的结果: 排名,酒店1,[其他领域],1 排名,酒店2,[其它领域] ,2 排名,酒店3,[其它领域],3 未评级,酒店4,[其它领域],0 未评级,Hotel4, [其他领域],0 未评级,酒店4,[其他领域],0 等... (即与Access相同) 我假设如果Access本身不反对SQL,那么它必须是 吧。因此,问题在于ADO和Access OLEDB驱动程序...... 有什么想法吗? Chris 解决方案 - Microsoft MVP - ASP / ASP.NET 请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我 不经常检查它。如果您必须离线回复,请删除 无垃圾邮件 I have a query which produces different results in the Access query builderand in an ASP page (via ADO) An example of the query is:----------------------------------------------------------Select ''Ranked'' as Source, H.HotelName, H.TelNo, H.URL, H.Location,H.HotelID, Rankfrom (Hotels H Inner Join PrefHotels P on H.HotelID = P.HotelID)Inner Join Locations L on P.LocID = L.LocIDwhere Rank is not null and Rank > 0 and L.LocID=2 Union Select ''Unranked'' as Source, H.HotelName, H.TelNo, H.URL, H.Location,H.HotelID, Rankfrom (Hotels H Inner Join PrefHotels P on H.HotelID = P.HotelID)Inner Join Locations L on P.LocID = L.LocIDwhere (Rank is Null or Rank = 0) and L.LocID=2 Order By Source, Rank---------------------------------------------------------- In Access, I get the following results Ranked, Hotel1, [other fields], 1Ranked, Hotel2, [other fields], 2Ranked, Hotel3, [other fields], 3Unranked, Hotel4, [other fields], 0Unranked, Hotel4, [other fields], 0Unranked, Hotel4, [other fields], 0etc... In my ASP Page I get these results: Unranked, Hotel1, [other fields],Unranked, Hotel2, [other fields],Unranked, Hotel3, [other fields],Unranked, Hotel4, [other fields],Unranked, Hotel4, [other fields],Unranked, Hotel4, [other fields],etc... I''ve imported the Access DB to SQL Server, and in Query Analyser and in theASP page I get the right result:Ranked, Hotel1, [other fields], 1Ranked, Hotel2, [other fields], 2Ranked, Hotel3, [other fields], 3Unranked, Hotel4, [other fields], 0Unranked, Hotel4, [other fields], 0Unranked, Hotel4, [other fields], 0etc... (ie Same as in Access) I''m assuming that if Access itself doesnt object to the SQL, it must beright. Therefore, the problem lies with ADO and the Access OLEDB drivers... Any ideas? Chris 解决方案 --Microsoft MVP - ASP/ASP.NETPlease reply to the newsgroup. This email account is my spam trap so Idon''t check it very often. If you must reply off-line, then remove the"NO SPAM" 这篇关于选择Qry:通过Access& amp;和ADO(& SQL Server)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-27 05:13