SSRS and creating parameter

  • Hi,

    I need to create a basic report that displays the userid, username, email, status and need to update the status column to enabled when we select any particular username. And the username parameter comes from the available users from the database

    How to do this?

    Do I need to mention the where clause where username=@username in the query or we don't need any

    Also I need to get the available distinct usernames from the database while entering the parameter username

    /*DECLARE variables to use IN queries*/

    DECLARE @intErrorCode INT

    DECLARE @ErrorMessage VARCHAR(MAX)

    DECLARE @user-id INT

    SET @ErrorMessage = 'Completed.'

    SELECT [userid] ,

    [accountstatus] ,

    ,

    [username]

    FROM [dbo].[Test1]

    WHERE [username] = @Username

    BEGIN TRANSACTION

    UPDATE [dbo].[Test1]

    SET [accountstatus] = 'ENABLED'

    WHERE [username] = @Username

    SELECT @intErrorCode = @@ERROR

    IF ( @intErrorCode <> 0 )

    BEGIN

    SET @ErrorMessage = 'Failed.'

    GO TO PROBLEM

    END

    SELECT [userid] ,

    [accountstatus] ,

    ,

    [username]

    FROM [dbo].[Test1]

    WHERE [username] = @Username

    /**************/

    COMMIT

    PRINT 'Changing locked account to enabled' + SPACE(1) + @ErrorMessage

    /**************/

    PROBLEM:

    IF ( @intErrorCode <> 0 )

    BEGIN

    PRINT 'Error … Rolledback'

    PRINT @ErrorMessage

    ROLLBACK TRANSACTION

    END.

    Basically first I need to find the userid, username, accountstatus, email for a given particular user. Then I need to update the accountstatus to enabled for that selected user.

    Also I need to create auditing that from before update and after update the accountstatus.

    Can some one help me with this report and creating audit

  • SSRS is not designed to update data, it is "reporting" services, so is designed to display data. If you really need to perform an update on the selected data, then you should be using another method for updating. .NET or Access are typical front ends that you would use for doing updates.

    I know of people who have used SSRS to perform updates to data, but it isn't the best way to do it.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply