Command的问题

hehongyu2000 2001-09-18 12:59:23
在vbscript中用Commmand.execute可以用以下格式.
<%@ Language="VBScript%>
<%
.......
objCommand.Execute ,,adExecuteStream '我只传第三个参数, 前两个是optional的
.......
%>

但我现在是用JScript, 我该如何写
<%@ Language="JScript"%>
<%
......
objCommand.Execute(??????) //我不知道怎样只传第三个参数
.....
%>
...全文
198 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
karma 2001-09-19
  • 打赏
  • 举报
回复
I have Beta 2

If you do not mind, where are you?
karma 2001-09-19
  • 打赏
  • 举报
回复
Sorry, I do not have OICQ.
hehongyu2000 2001-09-19
  • 打赏
  • 举报
回复
Can we have a conversation in QQ, Thanks. QQ:41889493
karma 2001-09-19
  • 打赏
  • 举报
回复
我问你人在哪里?美国么?
hehongyu2000 2001-09-18
  • 打赏
  • 举报
回复
Which version .NET you installed. I have installed .NET beta 1. Did you
install .NET beta 2.
karma 2001-09-18
  • 打赏
  • 举报
回复
OS: Win2000 Professional
ADO version 2.7 (which comes with .Net)
Server SQL 2000
hehongyu2000 2001-09-18
  • 打赏
  • 举报
回复
I still have this error.

Error Type:
Provider (0x80040E5D)
Parameter name is unrecognized.

I just saw the version of Script Engine is defferent, then I updated my Script
Engine to the same version with you, but still have this error. What's wrong
with me. Can you tell me your detail configuration, about ADO version and OLEDB
version.

Thank you very much.

karma 2001-09-18
  • 打赏
  • 举报
回复
Yes, I have IE6 +SQL Server 2000+.NET installed on a Win2k Professional machine

Here is the code, make sure you change UID and PWD:

<%@ Language=JavaScript %>
<%
var adoConn;
adoConn = Server.CreateObject("ADODB.Connection");

var sConn;
sConn = "provider=sqloledb;server=(local);database=northwind;uid=sa;pwd=;"; //
adoConn.ConnectionString = sConn;
adoConn.CursorLocation = 3;
adoConn.Open();

var adoCmd
adoCmd = Server.CreateObject("ADODB.Command")
adoCmd.ActiveConnection = adoConn;

var sQuery;
sQuery = "<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql'><sql:query>select top 1 lastname from employees</sql:query></ROOT>";
var adoStreamQuery;
adoStreamQuery = Server.CreateObject("ADODB.Stream");
adoStreamQuery.Open();
adoStreamQuery.WriteText(sQuery, 0);
adoStreamQuery.Position = 0

adoCmd.CommandStream = adoStreamQuery
adoCmd.Dialect = "{5D531CB2-E6Ed-11D2-B252-00C04F681B71}"

Response.Write("Version:" + ScriptEngineMajorVersion() + "." + ScriptEngineMinorVersion() + " build " + ScriptEngineBuildVersion() + "<br>");
Response.write("Pushing XML to client for processing " + "<BR/>");

adoCmd.Properties("Output Stream") = Response
Response.write("<XML ID=MyDataIsle>");
adoCmd.Execute(null, null, 0x400); //I have resolved the optional parameter problem, but still have the other error.
Response.write("</XML>");
%>
hehongyu2000 2001-09-18
  • 打赏
  • 举报
回复
So. It is working in your machine. What is the different. Why it can't be
run in my machine. Please post the whole code after your modified.

I found you JScript Version is 5.6. Have you installed IE6.0 or .NET
karma 2001-09-18
  • 打赏
  • 举报
回复
it seems
adoCmd.Execute(null, null, 0x400);
worked.

I tried your script, modified
sConn = "provider=sqloledb;server=(local);database=northwind;uid=sa;pwd=;"; //
....
sQuery = "<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql'><sql:query>select top 1 lastname from employees</sql:query></ROOT>";


I got back
Version:5.6 build 6626<br>Pushing XML to client for processing <BR/><XML ID=MyDataIsle><ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">Buchanan</ROOT></XML>
hehongyu2000 2001-09-18
  • 打赏
  • 举报
回复
Yes, the error message is changed to:
Parameter is unrecognized
karma 2001-09-18
  • 打赏
  • 举报
回复
have you tried
objCommand.Execute(null, null, adExecuteStream);
hehongyu2000 2001-09-18
  • 打赏
  • 举报
回复
大哥, 能帮我调一段code吗, 谢谢!!!

Environment:
OS: Win2000
Database: SQLServer 7 以上
ADO: 2.5以上
OLEDB: 2.5以上
-----------------------------------------------------------
<%@ Language=JavaScript %>
<%
var adoConn;
adoConn = Server.CreateObject("ADODB.Connection");

var sConn;
sConn = "provider=sqloledb;server=(local);database=test;Trusted_Connection=Yes"; //换成你的database connection.
adoConn.ConnectionString = sConn;
adoConn.CursorLocation = 3;
adoConn.Open();

var adoCmd
adoCmd = Server.CreateObject("ADODB.Command")
adoCmd.ActiveConnection = adoConn;

var sQuery;
sQuery = "<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql'><sql:query>select top 1 name from person</sql:query></ROOT>"; //换成你的sql statement

var adoStreamQuery;
adoStreamQuery = Server.CreateObject("ADODB.Stream");
adoStreamQuery.Open();
adoStreamQuery.WriteText(sQuery, 0);
adoStreamQuery.Position = 0

adoCmd.CommandStream = adoStreamQuery
adoCmd.Dialect = "{5D531CB2-E6Ed-11D2-B252-00C04F681B71}"

Response.Write("Version:" + ScriptEngineMajorVersion() + "." + ScriptEngineMinorVersion() + " build " + ScriptEngineBuildVersion() + "<br>");
Response.write("Pushing XML to client for processing " + "<BR/>");

adoCmd.Properties("Output Stream") = Response
Response.write("<XML ID=MyDataIsle>");
adoCmd.Execute(null, null, 0x400); //I have resolved the optional parameter problem, but still have the other error.
Response.write("</XML>");
%>

hehongyu2000 2001-09-18
  • 打赏
  • 举报
回复
Version 5.5 build 5207
karma 2001-09-18
  • 打赏
  • 举报
回复
what JScript version are you using? I know
objCommand.Execute(void(0), void(0), adExecuteStream);
works for JScript 5.1 and up
hehongyu2000 2001-09-18
  • 打赏
  • 举报
回复
同样的错误
karma 2001-09-18
  • 打赏
  • 举报
回复
then try
var v1,v2;
objCommand.Execute(v1, v2, adExecuteStream);
hehongyu2000 2001-09-18
  • 打赏
  • 举报
回复
有错误:
ADODB.Command (0x800A0E7C)
Parameter object is improperly defined. Inconsistent or incomplete information was provided.
karma 2001-09-18
  • 打赏
  • 举报
回复
try
objCommand.Execute(void 0, void 0, adExecuteStream);

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧