adding to a Stored Proc

Results 1 to 2 of 2

Thread: adding to a Stored Proc

  1. #1
    Join Date
    Dec 1969

    Default adding to a Stored Proc

    Normally I would use:<BR><BR>Set ClientRes = SQLQuery("Select * FROM company where coid=" & data_id)<BR><BR>But I am trying to tech myself how to use Stored Procs. The SProc is called Cl_coname. (see below)<BR><BR>Set ClientRes = conn.Execute(cl_coname)<BR><BR>when I am trying to run this I am getting an object required: " error? I know the SProc works, what am I doing wrong?<BR><BR>Also, how would I add "where coid=" & data_id" (as seen above) to this statement?<BR><BR>-H

  2. #2
    Evel Knievel Guest

    Default RE: adding to a Stored Proc

    A stored procedure would look something like :<BR><BR>ALTER PROCEDURE spCl_coname<BR> (<BR> @data_id int<BR> )<BR>AS<BR> SELECT * FROM Company WHERE coid = @data_id<BR>RETURN <BR><BR>To call this from your ASP code, you could do something like :<BR><BR>Set cmd = Server.CreateObject("ADODB.Command")<BR> <BR> With cmd<BR> .CommandType = adCmdStoredProc<BR> .CommandText = "spCl_coname"<BR> .Parameters.Append .CreateParameter("coid", adInteger, adParamInput, 4, null)<BR> <BR> .ActiveConnection = cnn<BR> End With<BR><BR>Set rs = Server.CreateObject("ADODB.RecordSet")<BR> Set rs = cmd.Execute<BR><BR>This code assumes you have a connection object already defined.

Posting Permissions

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