尽量别用this
或者var module=this;
来赋值下

解决方案 »

  1.   

    这时存在this.rs尚未处理完成而第二个rs又将覆盖掉this.rs
    怎么会存在这样的情况?
      

  2.   

    当然会,例如var a = new dbconn();
    a.getconn();
    var rs = a.getrs(sql);
    a.setrs(rs);while (rs.next)
    {
      var rs1 = a.getrs(sql1);
      var setrs(rs1);
    }这个时候就出现了this.rs被覆盖掉的问题
      

  3.   

    你的dbconn设计就决定了你只能存在一个RecordSet,如果你要想同时存在多个,可以考虑集合类型...
      

  4.   

    For Example :
    [code=JScrip]
    //数据库类 
    function dbconn(){ 
    var filePath=""; 
    var path=""; 
    var conn; 
    var rss;         // store the re collection
    } //连接数据库 
    dbconn.prototype.getconn = function(){ 
    this.filepath = location.href.substring(0,location.href.indexOf("mutMath")); 
    this.path = filePath + "math.mdb"; 
      this.conn = new ActiveXObject("ADODB.Connection"); 
    this.conn.Privider = "Microsoft.Jet.OLEDB.4.0"; 
    this.conn.ConnectionString = "Data Source = " + path; 
    this.conn.open; 
    } //添加|设置 recordSet 
    dbconn.prototype.setrs = function (Recordset,id){ 
    this.rss[id]=(Recordset);      
    } //返回 recordSet
    dbconn.prototype.setrs = function (id){ 
    return this.rss[id]
    } //执行SQL
    dbconn.prototype.executeSQL = function (sql){ 
    var Recordset = new  ActiveXObject("ADODB.Recordset");  
    Recordset.open (sql,this.conn); 
    return Recordset; 

    [/code]
      

  5.   

        感谢yonghengdexingxing的回答,你的回答很有参考。谢谢!我也仔细想了下方法,有点头绪。
      

  6.   

    function dbconn(){
    var filePath="";
    var path="";
    var conn;
    var rss;        // store the re collection
    }如果用prototype的話,構造里的這些申明都木有意義啦。