calling Stored Procedure with JScript

Results 1 to 2 of 2

Thread: calling Stored Procedure with JScript

  1. #1
    Join Date
    Dec 1969

    Default calling Stored Procedure with JScript

    I am trying to execute stored procedures using jscript from an asp. I get an eof or bof error but I know there is a record. Here&#039s my SP: <BR> <BR>CREATE PROCEDURE Test AS<BR>DECLARE @sPageID int, @sLangCode varchar (2)<BR>SELECT description from Page<BR>where Page_ID = @sPageID<BR>and Language_Code=@sLangCode<BR> <BR>Here&#039s my code from the asp. Any help is appreicated<BR> <BR>var sPageID = "1";<BR>var sLangCode = "en";<BR> <BR>//ADO CONSTANTS<BR>var adCmdStoredProc = 4;<BR>var adParamInput = 1;<BR>var adInteger = 2;<BR>var adVarChar = 2;<BR>var loCommand = Server.CreateObject("ADODB.Command");<BR>var loParam;<BR> <BR> <BR> <BR>//ADO COMMAND OBJECT THAT EXECUTES THE SP<BR>{<BR>loCommand.CommandText = "test";<BR>loCommand.CommandType = adCmdStoredProc;<BR>loCommand.Name = "test";<BR> <BR>//APPEND PARAMETERS, VARS<BR>loParam = loCommand.CreateParameter("sPageID", adInteger, adParamInput); loCommand.Parameters.Append(loParam);<BR>loParam = loCommand.CreateParameter("sLangCode", adVarChar, adParamInput);<BR>loCommand.Parameters.Append(loPa ram);<BR>loCommand.ActiveConnection = oORCon;<BR> <BR>oPage = Server.CreateObject("ADODB.Recordset");<BR>oPage.O pen("Exec test", oORCon);<BR>}<BR> <BR> <BR> <BR> <BR>

  2. #2
    Bruno Santos Guest

    Default RE: calling Stored Procedure with JScript

    it could be this simple:<BR><BR>{<BR>sQuery="Exec "+sPageID+",&#039"+sLangCode+"&#039";<BR>oPage=oOR Con.Execute(sQuery);<BR>}<BR><BR>Brunovski &#060;;<BR >

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts