Connection String

Discussion in 'Databases' started by colorado, Mar 9, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Please can anyone tell me what is wrong with these connection string?





    <%


    Option Explicit
    ' Dimension Local variables
    Dim objConn
    Dim objRS
    Dim strDSN
    Dim strSQL
    Dim intTotalColumns
    Dim intCounter


    ' Set the ADO Constants if you are not including
    ' the adovbs.inc file
    Const adOpenStatic = 3
    Const adLockReadOnly = 1


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


    strDSN = "DSN=DB_226227_booksng_sqlConn;UID=DB_226227_booksng_user;PWD=adebola"


    objConn.Open strDSN


    strSQL = "SELECT * FROM Orders"


    objRS.Open strSQL, objConn, adOpenStatic,adLockReadOnly


    ' get the total number of columns
    intTotalColumns = objRS.Fields.Count - 1
    %>

    <%


    ' Close Recordset
    objRS.Close
    Set objRS = Nothing


    objConn.Close
    Set objConn = Nothing
    %>
    i get these error




    Microsoft OLE DB Provider for ODBC Drivers error '80004005'


    [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified


    /test.asp, line 23
     
  2. Hello Joel,

    i have changed the DSN to a DSNless connection as below and i still get an error:





    Microsoft OLE DB Provider for ODBC Drivers error '80004005'


    [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SQL Server does not exist or access denied.


    /thead.asp, line 43
    this is the new conection string i used:

    Dim objConn
    Set objConn = Server.CreateObject("ADODB.Connection")
    Set rsSearch = Server.CreateObject("ADODB.RecordSet")

    objConn.Open "Driver={SQL Server};" &amp; _
    "Server=mssql03.discountasp.net;" &amp; _
    "Address=64.79.161.6,1433;" &amp; _
    "Network=DBMSSOCN;" &amp; _
    "Database=DB_xxxx;" &amp; _
    "Uid=xxx;" &amp; _
    "Pwd=xxx"


    sqltext= "SELECT SearchTitle, SearchValue FROM dbo.SearchCriteria ORDER BY SearchTitle ASC"

    rsSearch.Open sqltext, objConn, 3, 3
    objConn.close

    there are lots of the DSNless connections for SQl, which do u recommend. Maybe i'm making a mistake somewhere.
     
  3. Hello Joel i have removed the Network and Address from my connection string but i get this error:





    Microsoft OLE DB Provider for ODBC Drivers error '80040e4d'


    [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'DB_226227_booksng_user'.


    /thead.asp, line 43
     
  4. Double check both the username and password. Make sure you also remove the ***** and replace that with your password.



    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page