⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conn.asp

📁 好东西值得下载如果谁有需要可互相交流谢谢大家
💻 ASP
字号:
<SCRIPT RUNAT=SERVER LANGUAGE=JAVASCRIPT>
//Class Conn()
function Conn() {
	//private variables
	var db = 'data/counter.mdb';
	var connStr = 'Provider = Microsoft.Jet.OLEDB.4.0;Data Source = ' + Server.mapPath(db);
	
	//public variables
	this.conn;
	
	//public function getConn()
	this.getConn = function() {
		try{
			this.conn = Server.createObject('ADODB.Connection');
			this.conn.open(connStr);
		}catch(exception){
			Response.write('<ol>');
			Response.write('<li>' + exception + '</li>');
			Response.write('<li>' + (exception.number & 0xFFFF) + '</li>');
			Response.write('<li>Microsoft Jet connection error</li>');
			//Response.write('<li>' + exception.description + '</li>');		//不打印错误信息,以防止报漏数据库地址
			Response.write('</ol>');
			//throw exception;		//不打印错误信息,以防止报漏数据库地址
			Response.end();			//停止执行,防止下面的错误发生
		}
	}

	//public function execute()
	this.execute = function(sqlStr) {
		try{
			return this.conn.execute(sqlStr);
		}catch(exception){
			Response.write('<ol>');
			Response.write('<li>' + exception + '</li>');
			Response.write('<li>' + (exception.number & 0xFFFF) + '</li>');
			Response.write('<li>' + exception.description + '</li>');
			Response.write('</ol>');
			Response.end();
		}
	}

	//public function close()
	this.close = function() {
		try{
			this.conn.close();
			delete conn;
		}catch(exception){
			Response.write('<ol>');
			Response.write('<li>' + exception + '</li>');
			Response.write('<li>' + (exception.number & 0xFFFF) + '</li>');
			Response.write('<li>' + exception.description + '</li>');
			Response.write('</ol>');
			Response.end();
		}
	}
}
</SCRIPT>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -