sqlserver login pblm from asp.net

  • hey all

    i have a sqlserver in my desktop and the connection to it is through windows authentication. when i access the database(sqlserver) from .net windows application i have no pblms but when i access the sqlserver from asp.net file i get login error.

    what is the remedy for this.thanx

    Rajiv.

  • Here is a sample connection string and query, to our SQL Server. It works great.

    I hope it helps.

    <%

    Response.Expires = 0

    ' Set variables, build connection string and open connection

    Dim objConn, objRS, strQuery, strConnection

    Set objConn = Server.CreateObject("ADODB.Connection")

    strConnection = "DSN=[data source name];Database=[database name];"

    strConnection = strConnection  & "UID=;PWD=[password]"

    objConn.Open strConnection

    ' Build Query String

    strQuery = "SELECT [fields]FROM 

    "

    strQuery = strQuery & "[WHERE clause]"

    strQuery = strQuery & "[Order By clause]"

    ' Set Record Set Object

    Set objRS = objConn.Execute(strQuery)

    %>

     

  • Post a sample of the connection string that is being used in the ASP.NET page/application...



    The ~BEST~ solution is always the simplest one!

  • Using your regular ASP connection as an example:

    Set objConn = Server.CreateObject("ADODB.Connection")

    strConnection = "DSN=[data source name];Database=[database name];"

    strConnection = strConnection  & "UID=;PWD=[password]"

    The "UID" and "PWD" in this connection string need to be a SQL login - NOT - a Windows and/or active directory user account.

    For example, using SQL Enterprise Manager:

    1.) Select a registered Server->Security->Logins

    2.) Create a new login giving it a name and password using "SQL Server authentication"

    3.) Make sure this new login has appropriate access permissions on needed databases/views/SP's etc.

    Use this login "UID" and "PWD" in your connection string in ASP.NET...give it a try



    The ~BEST~ solution is always the simplest one!

  • hey guys

    thanx all for ur efforts and help. i reinstalled sqlserver. the pblm got solved.....i dont know how?

    but i think thats microsoft probably

    Rajiv.

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

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