Connection.Execute如何在VBScript中工作?

时间:2017-01-30 14:54:43

标签: javascript sql vbscript recordset

Connection.Execute如何在VBScript中运行?

Dim Connection
Set Connection = CreateObject("ADODB.Connection")
connection.open(Parameter)

Dim sql
sql = "sql query"

Dim RowsReturn
Err.Clear
Connection.CommandTimeout = 30  
Connection.Execute SQLStatement, RowsReturn, 1

我正在尝试用JavaScript重写代码。我在下面缺少什么?

var connection = new ActiveXObject("ADODB.Connection");
var rs = new ActiveXObject("ADODB.Recordset");  
connectionstring = "Connection String "
connection.Open(connectionstring);

var sql = "Sql query"

rs = connection.execute(sql);

我需要帮助理解陈述Connection.Execute SQLStatement, RowsReturn, 1

1 个答案:

答案 0 :(得分:1)

行返回的语法:

Set objrs=objconn.Execute(commandtext,ra,options)

非行返回的语法:

objconn.Execute commandtext,ra,options

commandtext:必填。要执行的SQL语句,存储过程或提供程序特定的文本

ra:可选。受查询影响的记录数

选项:可选。设置提供程序应如何评估commandtext参数

在你的情况下:

  1. commandText = SQLStatement
  2. ra = RowsReturn
  3. options = adCmdText = 1
  4. 参见ADO Execute Method documentationoptions documentation

    我希望它可以帮到你。再见。