StrSQL="Select * from "&DataTable&" Where ID In("& ID &") and Shop_ID="&Shop_ID&Taxis
如何获取他的记录数?@@ROWCOUNT Select count(*) from StrSQL="Select count(*) from "&DataTable&" Where ID In("& ID &") and Shop_ID="&Shop_ID&Taxis count(1) 不明白啊 顶 StrSQL="Select COUNT(*) from "&DataTable&" Where ID In("& ID &") and Shop_ID="&Shop_ID&Taxis 在程序中这样用 看楼主的语句,应该是在开发程序时使用ado对象连接sql然后返回数据的吧,如果是这样,那么ado对象都会有一个属性标识这次操作返回了多少行记录的.如果直接在sql里运行,那么可以用系统变量@@rowcount来去的记录数.
declare @rows int select * from 表名 where 条件 set @rows = @@rowcount select @rows 这段代码就能返回所查询的记录数了. StrSQL="Select count(*) from "&DataTable&" Where ID In("& ID &") and Shop_ID="&Shop_ID&Taxis 两种都可以: 1.Count(*) 2.@@Rowcount