当关闭结果集(基本ODBC的问题) [英] When to close the result set (Basic ODBC question)

查看:94
本文介绍了当关闭结果集(基本ODBC的问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作对当地公司的一些小项目,下面code运行我的机器上很好,但它自己的服务器上产生错误。目前,我没有访问该服务器,这是不是说我知道了很多关于一个领域,所以我要问你们。

I am working on some small project for the local firm and the following code runs fine on my machine, but it produces errors on their server. Currently I don't have access to that server, and this is not a field that I know a lot about, so I have to ask you guys.

页面上写的是传统的ASP(JavaScript的脚本编写)。
逻辑是这样的:

The page is written in the classic ASP (javascript for scripting). The logic goes like this:

conn.Open("myconnection");
bigQuery = "...";
rs = conn.execute(bigQuery);
while (!rs.eof) {
    ...
    smallQuery = "..."
    rssmall = conn.execute(smallQuery);
    ...
    rssmall.close();
    ...
    rs.movenext();
}
rs.close();
conn.close();

正如我所说的这个运行在我的机器上很好,但它返回一些错误(最糟糕的事情是,我甚至不知道什么是错误)公司的服务器上的如果大量查询返回超过〜20行。是不是有什么毛病我code(这真的不是我的领域,但我想它是确定在这样的循环来收集数据?),或者是有什么毛病了IIS服务器。

As I said this runs fine on my machine, but it returns some error (the worst thing is that I don't even know what error) on company's server if bigQuery returns more than ~20 rows. Is there something wrong with my code (this really isn't my field, but I guess it is ok to gather data in the loop like this?), or is there something wrong with their IIS server.

感谢。

编辑:
更多信息:
这是Access数据库。一切是pretty标准:

edit: More info: It 's Access database. Everything is pretty standard:

conn=Server.CreateObject("ADODB.Connection");
conn.Provider="Microsoft.Jet.OLEDB.4.0";
conn.Open("D:/db/testingDb.mdb");

查询是有点长,所以我不会张贴。他们是完全普通的选择,使他们不是问题。

Queries are bit long, so I wont post them. They are totally ordinary selects so they aren't the issue.

推荐答案

我有,我继承了非常相似的运行良好(在循环中运行检索的第一个查询的结果等查询大查询)的传统经典的ASP应用程序直到被退回四十多个记录。我解决的方式,问题是另一个实例连接对象来运行其他查询。因此,使用你的伪code,试试 -

I had a legacy Classic ASP application which I inherited that was very similar (big queries with other queries running within the loop retrieving the first query's results) that ran fine until forty or more records were returned. The way I "solved" the problem was to instantiate another connection object to run the other query. So using your pseudo code, try --

conn.Open("myconnection");
conn2.Open("myconnection")

bigQuery = "...";
rs = conn.execute(bigQuery);
while (!rs.eof) {
    ...
    smallQuery = "..."
    rssmall = conn2.execute(smallQuery);
    ...
    rssmall.close();
    ...
    rs.movenext();
}
rs.close();
conn2.close();
conn.close();

这篇关于当关闭结果集(基本ODBC的问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆