JScript Simulation ADO.NET Basic Object

xiaoxiao2021-03-06  46

<% @ Language = "jscript" CODEPAGE = "936"%> <% / * ado.net module for ASP

Error: err.nameerr.Messageerr.Description

* /// oledbconnection class function oledbconnection (strconnection) {

This.connectionsTRING = STRCONNECTION; this.connection = server.createObject ("adodb.connection"); this.connection.connectionstring = this.connectionstring;

This.open = function () {THIS.CONNECTION.CONNACTIONSTRING = this.connectionstring; this.connection.open ();} catch (err) {err.name = "connection open error" debug (err);}}

THIS.CLOSE = function () {THIS.CONNECTION.CLOSE;} catch (err) {Err.Name = "Connection Close Error" Debug (Err);}}

// Return this.Connection;

// OLEDBCommand Class function OLEDBCommand (strCommandText, objConnection) {this.CommandText = strCommandText; this.Connection = objConnection; this.Command = Server.CreateObject ( "ADODB.Command"); this.Command.CommandType = 8; // adCmdUnknown This.command.commandtext = this.commandtext;

this.ExecuteReader = function () {try {this.Command.CommandText = this.CommandText; this.Command.ActiveConnection = this.Connection.Connection; return this.Command.Execute;} catch (err) {err.name = " ExecuteReader Error "Debug (ERR);}}

this.ExecuteNonQuery = function () {try {this.Command.ActiveConnection = this.Connection; this.Command.Execute;} catch (err) {err.name = "ExecuteNonQuery Error" Debug (err);}} // prototype : Parameters this.Parameters = function (strParametersName, strParametersValue) {this.Parameters.Name = strParametersName; this.Parameters.Value = strParametersValue; if ((this.Parameters.Name) && (this.Parameters.Value)) {this. Command.Parameters (this.Parameters.Name) = this.Parameters.Value;}} // prototype: AddParameters this.CreateParameters = function (strParametersName, intParametersType, intParametersDirection, intParametersSize, strParametersValue) {this.Parameters.Name = strParametersName; this .Parameters.Type = intParametersType; this.Parameters.Direction = intParametersDirection; this.Parameters.Size = intParametersSize; this.Parameters.Value = strParametersValue; this.Command.Parameters.Append (this.Command.CreateParameter ( This.Parameters.Name, this.Parameters.Direction, this.parameters.size, this.parameters.value);}

Function debug (err) {response.write (Err.Name); response.write ("
") response.write (err.description); response.end} // returnimmand}%>

转载请注明原文地址:https://www.9cbs.com/read-80374.html

New Post(0)