SQL DSN Connection error

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. Hi Bruce,


    Sorry for bothering you, i have been waiting for your response all day.


    Colorado
     
  2. Hi guyz,

    i am trying to connct to my SQL database, i keep receiveinv this error:

    '


    ADODB.Recordset error '800a0e7d'


    The connection cannot be used to perform this operation. It is either closed or invalid in this context.


    /thead.asp, line 48 '





    This is the code:


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

    objConn.ConnectionString = "Provider=SQLOLEDB; Data Source=Server=xxxxx; Initial Catalog=DB_xxx_bbbb; User ID=DB_xxx_bbbb_user; Password=xxxx"

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

    rsSearch.Open sqltext, objConn, 3, 3


    Please is there anything i'm doing wrong?
     
  3. I don't see you calling objConn.Open

    whenever you call Open, ALWAYS make sure to have a Close following!!!


    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  4. Please could you help me with the syntax. I had just opened it but still got an error.


    Thanks
     
  5. Thanks a lot Joel, this is the code :


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


    objConn.open "DSN=DB_xxx;UID=DB_sss;PWD=ggg;DATABASE=DB_ddd"


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



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





    Cant see exactly what i'm doing wrong
     
  6. Are you still receiving the same error message?

    You are specifyingadOpenStatic andadLockOptimistic as options for opening the connection. Try to remove the ",3,3". This probably won't fix it, but we'll try to reduce this down to the lowest common denominator :)

    I'd also recommend against using DSN


    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