Call stored procedure in JScript

Call stored procedure in JScript

Post by lifeng x » Sat, 27 Apr 2002 23:10:21



Can someone give me an example of using JScript to call a
SQL Server stored procedure through ADO? The stored
procedure should return a recordset with select statement,
and it will take at least one input prarm. I have been
trying to do this in my ASP pages. But I can't make it
work.

Thanks

 
 
 

1. ADO stored procedure call in JScript

I am trying to make an ADO stored procedure call in my ASP
page using JScript. The following is the code:

                var cn = Server.CreateObject
("ADODB.Connection");
                var cm = Server.CreateObject
("ADODB.Command");
                var rs = Server.CreateObject
("ADODB.Recordset");
                cn.Open(data_dsn);
                cm.ActiveConnection = cn;
                cm.CommandText = "SP_GRP_URL";
                cm.CommandType = 1; // stored procedure
                cm.Parameters.Append(cm.CreateParameter
("USERID", 129, 1, 50));
                cm.Parameters("USERID") = USERID;
                rs = cm.Execute;

The problem is that I am getting an error message says
that"[Microsoft][ODBC SQL Server Driver][SQL Server]

was not supplied.". But as you can see from the code, I do
pass the input parameter "USERID" with the call.

What is wrong? What is the right way to do this?

Could someone help me on this?

Many thanks.

Lifeng

2. String to remote PORT

3. Calling Stored Procedure that calls Stored Procedure in ASP

4. Installation of SQL 7.0 on win2k SP2

5. Calling a Java Stored Procedure from another Java Stored Stored Procedure

6. Finding if Instance of SQL Server is running locally

7. help trans jscript file to stored procedure...

8. ADO VS DAO

9. Help ! Jscript/ADO/Oracle Stored Procedure Exception Handling

10. Stored Procedure calling Stored Procedure

11. Call a stored procedure from another stored procedure

12. Calling a stored procedure with parameters from another stored procedure

13. Calling a Stored Procedure from a Stored Procedure