Stored Procedure : Re-Posted

Results 1 to 3 of 3

Thread: Stored Procedure : Re-Posted

  1. #1
    Hemant Visal Guest

    Default Stored Procedure : Re-Posted

    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 : Re-Posted

    Ok, lets see if we can solve this one.<BR>First of all what is your objConn set to?

  3. #3
    Hemant Visal Guest

    Default RE: Stored Procedure : Re-Posted

    I am setting the connection as below :<BR>Dim objConn <BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR><BR>obj Conn.Open "Provider=SQLOLEDB;;User ID=abc;password=abc;Initial Catalog=userDB;Initial File Name=C: empDBdatabaseuserDB_Data.mdf"<BR><BR>If Err.number &#060;&#062; 0 then<BR> Response.Write "Failed to connect. Please try again...."<BR> Response.End<BR> Session.Abandon<BR>End If

Posting Permissions

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