JScript 模拟 ADO.NET 基本对象

此博客主要围绕ASP中ADO.NET模块展开,定义了OLEDBConnection和OLEDBCommand两个类。OLEDBConnection类用于处理数据库连接的打开与关闭,OLEDBCommand类用于执行数据库命令,包含执行查询和非查询操作,还涉及参数设置等功能,同时有错误调试函数。

<%@ Language="JScript" CODEPAGE = "936" %>
<!-- METADATA TYPE="TypeLib" UUID="00000200-0000-0010-8000-00AA006D2EA4" -->
<%
/*
ADO.NET Module For ASP

Error:
err.name
err.message
err.description

*/
// OLEDBConnection Class
function OLEDBConnection(strConnection)
{

  this.ConnectionString = strConnection;
  this.Connection = Server.CreateObject("ADODB.Connection");
  this.Connection.ConnectionString = this.ConnectionString;

  this.Open = function()
  {
    try {
      this.Connection.ConnectionString = this.ConnectionString;
      this.Connection.Open();
    }   catch(err) {
      err.name = "Connection Open Error"
      Debug(err);
    }
  }

  this.Close = function()
  {
    try {
      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.Type, this.Parameters.Direction, this.Parameters.Size, this.Parameters.Value));
  }

  function Debug(err)
  {
    Response.Write (err.name);
    Response.Write ("<br>")
    Response.Write (err.description);
    Response.End
  }
//  return this.Command
}
%>

内容概要:本文围绕不确定环境下的多式联运路径优化问题展开研究,提出并实现了基于AFO算法、遗传算法(GA)和粒子群优化算法(PSO)的三种智能优化方法,并借助Matlab平台完成算法编程与仿真。研究构建了考虑时间、成本、转运风险等多重不确定因素的路径优化模型,系统比较了AFO、GA、PSO三种算法在收敛速度、全局寻优能力和稳定性方面的表现,同时引入Matlab自带的全局优化搜索器作为基准对照,深入分析各算法在复杂物流网络中的适用边界与性能差异。研究表明,AFO算法在解决此类组合优化问题时展现出更快的收敛效率和更强的局部规避能力。; 适合人群:具备一定Matlab编程基础与运筹优化知识,从事物流工程、交通运输规划、智能算法开发等相关领域的研究生、科研人员及工程技术人员。; 使用场景及目标:①应用于多式联运、综合货运网络中的路径决策支持系统构建;②为不确定性条件下复杂路径规划问题提供智能算法选型依据与技术实现方案;③支持科研人员复现主流优化算法并开展横向性能对比实验,推动算法改进与实际落地。; 阅读建议:建议读者结合提供的Matlab代码逐模块分析算法实现流程,重点理解目标函数设计、约束条件处理及参数敏感性分析部分,可通过调整问题规模与算法参数进行对比实验,进一步拓展至动态路径规划或大规模网络优化等延伸场景。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值