TO SQL GURUS on stored procedures.

Results 1 to 2 of 2

Thread: TO SQL GURUS on stored procedures.

  1. #1
    della Guest

    Default TO SQL GURUS on stored procedures.

    &nbsp;<BR> I&#039m trying to execute my stored procedure, but I<BR> get the "too many arguments" error -- even though<BR> the count seems fine to me. What the heck is<BR> going on?<BR><BR> MY PRCOEDURE: <BR> Create Procedure sp_addschool<BR> @u_school varchar(30),<BR> @u_pass varchar(30),<BR> @u_fname varchar(30),<BR> @u_lname varchar(30),<BR> @u_state varchar(30),<BR> @u_id int output<BR> As<BR> set nocount on<BR> if not exists(select u_id from t_user where <BR> u_school=@u_school)<BR> begin<BR> .. blah (does this matter for this error?)<BR> end<BR> else<BR> select @u_id=-1<BR> return ;<BR><BR> -------------------------------------------------<BR> MY CODE:<BR><BR> Dim oCmd<BR> Set oCmd = Server.createobject("ADODB.Command")<BR> Set oCmd.ActiveConnection = oConn<BR> oCmd.CommandText = "sp_addschool"<BR> oCmd.CommandType = adCmdStoredProc<BR> oCmd.Parameters.append oCmd.CreateParameter("u_school", adVarChar,<BR> adParamInput,30,sSName)<BR> oCmd.Parameters.append oCmd.CreateParameter("u_pass", adVarChar,<BR> adParamInput,30,sPass)<BR> oCmd.Parameters.append oCmd.CreateParameter("u_fname", adVarChar,<BR> adParamInput,30,sFName)<BR> oCmd.Parameters.append oCmd.CreateParameter("u_lname", adVarChar,<BR> adParamInput,30,sLName)<BR> oCmd.Parameters.append oCmd.CreateParameter("u_state", adVarChar,<BR> adParamInput,30,sState)<BR> set oReturn = oCmd.CreateParameter("u_id", adInteger, adParamOutput)<BR> oCmd.Parameters.append oReturn<BR> oCmd.execute()

  2. #2
    Manoj Guest

    Default RE: TO SQL GURUS on stored procedures.

    I have experienced some strange problems with createparameter command, append and execute it with command object. <BR><BR>Instead of creating parameters try this<BR><BR>cmd.Parameters("@Yourparameter").Value =Porper type of value[Use Cstr, Cint Fucntions to convert]<BR><BR>ocmd.execute<BR><BR>It will work.<BR><BR>-Manoj<BR><BR><BR><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