Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   ASP (https://www.askmehelpdesk.com/forumdisplay.php?f=451)
-   -   I can't connect my ASP page with MSSQL (https://www.askmehelpdesk.com/showthread.php?t=29090)

  • Jul 7, 2006, 12:08 PM
    Grammarian-Bot
    I can't connect my ASP page with MSSQL
    This is what my connect.asp looks like.

    <Html>
    <Head>
    <Title> Testing Our Connection </Title>
    </Head>
    <Body>
    <%
    Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
    adOpenForwardOnly=0
    adLockReadOnly=1
    adCmdTable=2

    Dim objConn, objRS
    Set objConn = Server.CreateObject("ADODB.CONNECTION")
    Set objRS = Server.CreateObject("ADODB.RECORDSET")

    Dim strDatabaseType
    strDatabaseType = "MSDE"

    objConn.Open "Driver={SQL Server};" & _
    "Server=127.0.0.1;" & _
    "Database=payroll;" & _
    "Uid=;" & _
    "Pwd=;"


    objRS.Open "payroll", objConn, adOpenForwardOnly,adLockReadOnly, adCmdTable

    While not objrs.eof
    rsponse.write objrs.fields("emp_id") & "<br>"
    objrs.movenext
    Wend

    objrs.Close
    Set objrs = Nothing

    objconn.Close
    Set objconn = Nothing
    %>
    </body>
    </html>


    But when I open it in my IE I get the following Error Message.



    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
    [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'ADMINISTRATOR\IUSR_FAHAD'.
    /begasp/connect.asp, line 22

    Line 22 is the connection string line on my editor.

    Please can someone telll me how can I fix this problem.
  • Jul 10, 2006, 12:50 AM
    LTheobald
    Has the username in the error message been given rights to access the database? That's what the error message is saying - the user doesn't have access to the db
  • Aug 7, 2008, 11:56 PM
    yesh kumar
    You should pass the Userid and Password details in UID and PWD. Now it is taking the Windows authentication to connect to SQL where it is getting failed.

  • All times are GMT -7. The time now is 03:59 AM.