Stored Procedure

Results 1 to 3 of 3

Thread: Stored Procedure

  1. #1
    Hemant Visal Guest

    Default Stored Procedure

    I am really fed up with this stored procedure. please , please help me out in finding the problem and also let me know the solution. My DB is SQL server 7.0. Code in .asp file is :<BR><BR>On Error Resume Next<BR><BR>Set objCmd = Server.CreateObject("ADODB.Command")<BR>Set objCmd.ActiveConnection = objConn <BR>objCmd.CommandText = "sp_returnIdentity"<BR>objCmd.CommandType = adCmdStoredProc<BR><BR>objCmd.Parameters.Append objCmd.CreateParameter("@login_id" adVarChar,adParamInput,15,"abcd")<BR>objCmd.Parame ters.Append objCmd.CreateParameter("@pwd" ,adVarChar,adParamInput,10,"abcd")<BR>objCmd.Param eters.Append objCmd.CreateParameter("@phoneno" ,adVarChar,adParamInput,12,"1234")<BR>objCmd.Param eters.Append objCmd.CreateParameter("@email_id" ,adVarChar,adParamInput,40,"")<BR> objCmd.Parameters.Append objCmd.CreateParameter("@type" ,adVarChar,adParamInput,10,"1")<BR>objCmd.Paramete rs.Append objCmd.CreateParameter("@name" ,adVarChar,adParamInput,10,"abcd")<BR>objCmd.Param eters.Append objCmd.CreateParameter("@identityval" ,adInteger,adParamReturnValue)<BR><BR>objCmd.Execu te()<BR><BR>Response.Write "Error : " & Err.number & " Desc : " & Err.Description & "<BR>"<BR>Response.Write "Identity Value = " & objCmd.Parameters("@identityval")<BR><BR>My stored procedure is :<BR><BR>CREATE PROCEDURE sp_returnIdentity (<BR> @login_id varchar(15),<BR> @pwd varchar(10),<BR> @phoneno varchar(12),<BR> @email_id varchar(40),<BR> @type int,<BR> @name varchar(40),<BR> @identityval int OUTPUT )<BR><BR>AS <BR> set nocount on <BR> begin <BR><BR> INSERT INTO [userDB].[dbo].[users] <BR> ( [login_id], [pwd], [phoneno], [email_id],<BR> [type],[name]) <BR> VALUES <BR> ( @login_id, @pwd, @phoneno, @email_id, @type, @name) <BR><BR> IF ( @@ERROR &#060;&#062; 0 )<BR> begin <BR> select @identityval = -1<BR> return @identityval <BR> end<BR> select @identityval = @@identity<BR> return @identityval <BR> end <BR><BR>I am getting error as :<BR><BR>Error : -2147217904 Desc : Procedure &#039sp_returnIdentity&#039 expects parameter &#039@login_id&#039, which was not supplied.<BR>Identity Value = -2147217904 Procedure &#039sp_returnIdentity&#039 expects parameter &#039@login_id&#039, which was not supplied.

  2. #2
    Join Date
    Dec 1969

    Default RE: Stored Procedure

    The first thing I can see is a lack of a comma:<BR>objCmd.Parameters.Append objCmd.CreateParameter("@login_id" adVarChar,adParamInput,15,"abcd") <BR><BR>should be <BR><BR>objCmd.Parameters.Append objCmd.CreateParameter("@login_id", adVarChar,adParamInput,15,"abcd") <BR><BR>Missing a comma after "@Login_id"<BR>

  3. #3
    Still not working Guest

    Default RE: Stored Procedure

    Actually my code in the ASP file is with a comma. But while posting the query I missed out the comma. sorry for that. But even with the comma it is not working.

Posting Permissions

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