我使用经典的asp并尝试使用以下查询打开记录集
query = "SELECT "+_
"op.""ID"","+_
"replace(op.""FIO"",'""','\""') AS FIO, "+_
"replace(op.""Fax"",'""','\""') AS Fax, "+_
"replace(p.""Phone"",'""','\""')AS Phone, "+_
"replace(p.""INN"",'""','\""') AS INN, "+_
"replace(v.""ParentID"",'""','\""') AS ParentID, "+_
"replace(v.""Name"",'""','\""') AS Name, "+_
"replace(v.""ShortName"",'""','\""') AS ShortName, "+_
"replace(v.""AddIndex"",'""','\""') AS AddIndex, "+_
"replace(v.""StateID"",'""','\""') AS StateID, "+_
"replace(coalesce(p.""Address"",op.""LawAddress""),'""','\""') as ""Address"", "+_
"replace(coalesce(p.""ZIPCode"",op.""LawZIPCode""),'""','\""') as ""ZIPCode"", "+_
"replace(coalesce(p.""Country"",op.""LawCountry""),'""','\""') as ""Country"", "+_
"replace(coalesce(p.""Oblast"",op.""LawOblast""),'""','\""') as ""State"", "+_
"replace(coalesce(p.""City"",op.""LawCity""),'""','\""') as ""City"", "+_
"replace(coalesce(p.""Address"",op.""LawAddress""),'""','\""') as ""Street"", "+_
"replace(coalesce(p.""House"",op.""LawHouse""),'""','\""') as ""House"", "+_
"replace(op.""LawOffice"",'""','\""') as ""Office"""+_
" FROM "+_
" DBO.""LDOrgPartner"" op, "+_
" DBO.""LDPartner"" p, "+_
" DBO.""LDVocabulary"" v "+_
" WHERE "+_
" p.""ID""=op.""ID"" AND "+_
" v.""ID""=op.""ID"" AND "+_
" v.""ObjectTypeID"" in (19,44) "&wherePart
response.Write(query)
Set rs = Server.CreateObject("ADODB.Recordset")
rs.PageSize=1000
rs.Open query, con
where wherePart="AND p."INN" LIKE '%38%'"
一切正常,但如果wherePart=" AND v."ShortName" LIKE '%ооо%'"
记录集rowcount为-1。在Management Studio中使用wherePart=" AND v."ShortName" LIKE '%ооо%'"
执行查询返回900行
答案 0 :(得分:1)
在代码中添加以下代码:
rs.CursorLocation = 3 'adUseClient
默认设置可能不允许动态遍历,因此“禁用”分页机制。