Regarding connection from SQL Server to ASP.NET Application

  • Hello... I'm Ayesha.

    I'm facing problem with data base connectivity in case of ASP.NET application. Whenever I try to connect to the SQL Server, I use to get the error message "LOGIN FAILED FOR THE USER <user name>". Please help me regarding that. Please suggest me, what should I do. I tried all the ways. I reinstalled .NET, IIS Server and even the SQL Server also.

    Please help me.

  • I think you are making this more complicated than you need to. As the message implies, the client is trying to connect with a loginname that has not been set up on the SQL Server. This could either be a standard SQL login/password combination, a Windows username or a Windows group. Find out what the app is using to connect and add it to the SQL Server logins.

    You will also have to associate the login with a database user.

  • The username should be at the end of the error message.

  • Ayesha,

    Try this website connection string.

    http://www.connectionstrings.com/

    For VB.NET with ASP.NET here is what you need, assuming that you are running IIS on the same machine as SQL Server with mix mode or Windows Authentication.

     

    <%@ Page Language="VB" Debug="true" %>

    <%@ import Namespace="System.Data" %>

    <%@ import Namespace="System.Data.SqlClient" %>

    <script runat="server">

    Dim ConnectionString As String = "server=(local);database=pubs;trusted_connection=true"

    dim MyConnection As New SqlConnection(ConnectionString)

    </script>

    I hope this will solve your problem.

     


    Kindest Regards,

    Syed
    Sr. SQL Server DBA

Viewing 4 posts - 1 through 3 (of 3 total)

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