JScript连接ADO的类


var db = {
commandText: "",
connectString: "Provider=Microsoft.Ace.OLEDB.12.0; Data Source=D:\\db1.accdb",
conn: new ActiveXObject("adodb.connection"),
open: function () { return this.conn.Open(this.connectString); },
close: function () { return this.conn.Close(); },
exec: function () { return this.conn.Execute(this.commandText); }
};
var i = user.id ;
i = user.add() ;
i = user.id ;
try {
db.open();
db.commandText = "select * From [user]" ;
var rs = db.exec();
while(!rs.EOF) {
var id = rs("userid");
var name = rs("name");
WScript.Echo( id + " " + name);
rs.MoveNext();
}
rs.Close();
db.close();
}catch(e)
{
WScript.Echo(e.message);
}

posted @ 2023-08-13 09:00  小风风的博客  阅读(8)  评论(0编辑  收藏  举报