關(guān)于rs.recordcount返回-1或1或0的解決辦法
發(fā)布日期:[2015/1/4] 編輯:奇億廣州網(wǎng)站建設(shè)
或許有些站長會遇到使用rs.recordcount有時返回是-1或1或0的情況,無論如何都無法取得記錄數(shù),下面找到幾種解決辦法,可參考試用解決:
1,使用rs.open sql,Conn,1,1標準模式打開數(shù)據(jù)庫,不可用快捷方式如set rs=conn.execute等,其中rs表示數(shù)據(jù)集recordset sql表示sql語句 conn表示數(shù)據(jù)連接connection對象 1,1表示靜態(tài)游標;
2,如第1條無法解決,可在rs.open sql,Conn,1,1前加上rs.cursorlocation=3,因為默認使用的是服務(wù)器游標,當取記錄集數(shù)時應(yīng)該使用客戶端游標;而conn后第一個數(shù)字是1時表示指針只能往前,3表示自由指針,例如還可使用rs.open sql,Conn,3,1,rs.open sql,Conn,3,2也是一樣的道理;
3,利用"select * from 表名",conn,1,1或"select * from 表名",conn,3,1打開數(shù)據(jù)庫表,原理同2。
一般來說rs.recordcount返回-1或1或0的情況均是conn打開數(shù)據(jù)庫使用的服務(wù)端游標的問題,改成客戶端游標即可解決。
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
![網(wǎng)站建設(shè)圖標](/images/dIcon.gif)
或者將本文《關(guān)于rs.recordcount返回-1或1或0的解決辦法》收藏和分享到:
復(fù)制本文《關(guān)于rs.recordcount返回-1或1或0的解決辦法》地址給好友:
復(fù)制本文《關(guān)于rs.recordcount返回-1或1或0的解決辦法》地址給好友: