提一个比较浅显的问题,思路上没转过来。希望高手们能多多帮忙 尽量别用this或者var module=this;来赋值下 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这时存在this.rs尚未处理完成而第二个rs又将覆盖掉this.rs怎么会存在这样的情况? 当然会,例如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被覆盖掉的问题 你的dbconn设计就决定了你只能存在一个RecordSet,如果你要想同时存在多个,可以考虑集合类型... 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); } //返回 recordSetdbconn.prototype.setrs = function (id){ return this.rss[id]} //执行SQLdbconn.prototype.executeSQL = function (sql){ var Recordset = new ActiveXObject("ADODB.Recordset"); Recordset.open (sql,this.conn); return Recordset; } [/code] 感谢yonghengdexingxing的回答,你的回答很有参考。谢谢!我也仔细想了下方法,有点头绪。 function dbconn(){var filePath="";var path="";var conn;var rss; // store the re collection}如果用prototype的話,構造里的這些申明都木有意義啦。 event.srcElement.type 火狐的问题??? AjaxFileUpload上传图片遇到的问题。 如何截取网页链接地址?? input name="file1" type="file“ 怎么过滤文件类型 只显示 *.bmp 或 *.* 梅雪香看到请进一下.其他高手也可以试试. JavaScript读取EXE文件的属性???? js 获取框架信息 [求助] 初学问题,如何在vbscript和javascript中进行变量传递 嘿嘿... 这个.. 有点意思..... 如何做到用ie打开word文件不能编辑 页面动态添加Textbox ?
怎么会存在这样的情况?
a.getconn();
var rs = a.getrs(sql);
a.setrs(rs);while (rs.next)
{
var rs1 = a.getrs(sql1);
var setrs(rs1);
}这个时候就出现了this.rs被覆盖掉的问题
[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]
var filePath="";
var path="";
var conn;
var rss; // store the re collection
}如果用prototype的話,構造里的這些申明都木有意義啦。