How do i create a Login for my client App?

  • hi,

    i have a client application written from C#/winforms app that needs access SQL DB on SQL server 2008 R2 developer. So i need to create a Login for this app with a user/password. But when i created it and put it on the client's connection string, the DB could not be accessed by the client windows forms app and the error was "Login failed for User App1".

    then i tried to login to SQL server from SSMS using the credentials of App1 but it also gave same error "Login failed for user App1". I have following the following steps of creation of the login for App1. i could login from "sa" account and other Admin accounts but not from "App1" account

    1. created a server level Login

    2. created a DB level user

    3. created a Role (a DB role), i even tried creating an App Role

    4. given permission to execute stored procedures that handle login

    but didn't work. Maybe i made some mistakes in those step. So is it possible for anyone here to give me step by step on how to create an account for user "App1" so it can be accessed by the client windows app and also from SSMS? i would prefer to use account creation from SSMS GUI.

    okay maybe this is somekind of a configuration mistake made in the installation so would anyone like to answer this post How do i install SQL server 2008R2 in local machine with network accessiility features?

    thanks

  • Hi,

    Do you have your local db to play with? I have couple of questions to move forward.

    Are you able to connect to the database with username and password? If not, did you try to use windows authentication to connect. I suspect there might be permission issue on the SQL login you created.

    What kind of role you need on the sql user? Below the sample i tried, works for me. I gave sysadmin role. you can specify what kind of role you need.

    USE [master];

    GO

    CREATE LOGIN SampleLogin

    WITH PASSWORD = N'Password123',

    CHECK_POLICY = OFF,

    CHECK_EXPIRATION = OFF;

    GO

    EXEC sp_addsrvrolemember

    @loginame = N'SampleLogin',

    @rolename = N'sysadmin';

    if you need to do using SSMS follow this link,

    [/url

    Hope this helps.

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

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