locked
inserting into my user table RRS feed

  • Question

  • create Procedure [dbo].[createUserDetails](
    @UserID int,
    @Login varchar(100),
    @Password varchar(50),
    @FirstName varchar(50),
    @LastName varchar(50),
    @EmailID varchar(150),
    @PhoneNumber varchar(20),
    @IPAddress varchar(20),
    @Active bit,
    @UserType int,
    @SecurityQuestion varchar(150),
    @SecurityAnswer varchar(150)
    )
    as

    if(@UserID=0)

    SET NOCOUNT ON;
    IF EXISTS
    (
    SELECT 1
    FROM Admin.[User]
    WHERE Login = @Login
    )
    BEGIN
    RAISERROR (N'LoginName %s already exists. Please choose another username.',
    16, -- Severity,
    1, -- State,
    @Login)
    RETURN -1
    END
    else
    Insert Into [Admin].[user](
    [Login],
    [Password],
    [FirstName],
    [LastName],
    [EmailId],
    [PhoneNumber],
    [IPAddress],
    [Active],
    [Created],
    [UserType],
    [SecurityQuestion],
    [SecurityAnswer]
    )
    Values(
    @Login,
    @Password,
    @FirstName,
    @LastName,
    @EmailID ,
    @PhoneNumber,
    @IPAddress,
    @Active ,
    GETDATE(),
    @UserType,
    @SecurityQuestion,
    @SecurityAnswer
    )

    is my correct and i am not adding from front end ipadress,securityquestion and answer and same time i am displaying a check column for usertype(but while inserting always it saying the error not able to execute storedprocedure) could some one help me 


    harika

    Friday, July 27, 2012 9:27 AM

Answers

  • Ok thats fine that you are calling your SP from business logic class, but to look further , and as you mentioned you are not having values for  ipaddress,securityquestion,security answer and User type. so for these you can have null values.

    But to look further, In SSMS, just try to execute this SP with some sample parameteres and see what is going on, or let us know if you get some error.


    Thanks
    Manish

    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    • Marked as answer by harika26 Friday, July 27, 2012 10:23 AM
    Friday, July 27, 2012 10:07 AM

All replies

  • Harika,

    You SP seem ok to me, could you please let us know how you are calling the SP and the exact error message.


    Thanks
    Manish

    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Friday, July 27, 2012 9:49 AM
  • i am calling my sp from my businesslogic class and in front i am not displaying any textboxes or any thing for ipaddress,securityquestion and security answer  nad my usertype i am showing in a check box while trying to execute it displaying i could not cal my sp or there is error in sp

    harika

    Friday, July 27, 2012 10:02 AM
  • Ok thats fine that you are calling your SP from business logic class, but to look further , and as you mentioned you are not having values for  ipaddress,securityquestion,security answer and User type. so for these you can have null values.

    But to look further, In SSMS, just try to execute this SP with some sample parameteres and see what is going on, or let us know if you get some error.


    Thanks
    Manish

    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    • Marked as answer by harika26 Friday, July 27, 2012 10:23 AM
    Friday, July 27, 2012 10:07 AM
  • i put a break point and traced only while executing the sp it showing the error and the values what i am sending are coming correctly as i have set null values for those which i am not passing 


    harika

    Friday, July 27, 2012 10:17 AM