Results 1 to 3 of 3

Thread: DB Connection

  1. #1
    Join Date
    Feb 2006
    Location
    Turkiye
    Posts
    15

    Unanswered: DB Connection

    Can any body help me for these codes edits? When I worked this file as this form, I get a error:
    " Don't allow work for object close"
    How do I change these codes for the work as correctly?

    Code:
    <%
    connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("hcver2002.mdb") & ";"
    
    if session("AdminName")="" then
    set AdminObjconn = server.createobject("ADODB.Connection") 
    Application("Connection1_ConnectionString") = AdminObjconn.GetStrAdvReg("General","ConnString")
    set AdminObjconn = Nothing
    End IF 
    
    set con = server.CreateObject("ADODB.Connection")
    con.Open Application("Connection1_ConnectionString")
    set rs = server.CreateObject("ADODB.RecordSet")
    set rs1 = server.CreateObject("ADODB.RecordSet")
    set rs2 = server.CreateObject("ADODB.RecordSet")
    %>
    HAVE RESPECT FOR AS LONG AS.

  2. #2
    Join Date
    May 2005
    Posts
    39
    It would be helpful to know which line is giving you the error, but I think the problem might be with these lines:
    Code:
    set AdminObjconn = server.createobject("ADODB.Connection") 
    Application("Connection1_ConnectionString") = AdminObjconn.GetStrAdvReg("General","ConnString")
    You need to open the connection before you can do anything with your AdminObjconn object, otherwise its just a connection object that doesn't point to any database.

    You should probably use this code:
    Code:
    set AdminObjconn = server.createobject("ADODB.Connection") 
    AdminObjconn.Open Your_Connection_String
    Application("Connection1_ConnectionString") = AdminObjconn.GetStrAdvReg("General","ConnString")

  3. #3
    Join Date
    Feb 2006
    Location
    Turkiye
    Posts
    15
    Quote Originally Posted by Yahweh
    It would be helpful to know which line is giving you the error, but I think the problem might be with these lines:
    Code:
    set AdminObjconn = server.createobject("ADODB.Connection") 
    Application("Connection1_ConnectionString") = AdminObjconn.GetStrAdvReg("General","ConnString")
    You need to open the connection before you can do anything with your AdminObjconn object, otherwise its just a connection object that doesn't point to any database.

    You should probably use this code:
    Code:
    set AdminObjconn = server.createobject("ADODB.Connection") 
    AdminObjconn.Open Your_Connection_String
    Application("Connection1_ConnectionString") = AdminObjconn.GetStrAdvReg("General","ConnString")
    Thanks for help but it is not work. now I get this error:

    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC Driver Manager] Didn't find database source name and it wasn't specify driver
    /inc_conn_open.asp, line 6


    My codes:
    Code:
    <%
    connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("..\private\hcver2002.mdb") & ";"
    
    if session("AdminName")="" then
    	set AdminObjconn = server.createobject("ADODB.Connection") 
    	AdminObjconn.Open Connection1_ConnectionString
    	Application("Connection1_ConnectionString") = AdminObjconn.GetStrAdvReg("General","ConnString")
    	set	AdminObjconn = Nothing
    End IF	
    
    set con = server.CreateObject("ADODB.Connection")
    con.Open Application("Connection1_ConnectionString")
    set rs = server.CreateObject("ADODB.RecordSet")
    set rs1 = server.CreateObject("ADODB.RecordSet")
    set rs2 = server.CreateObject("ADODB.RecordSet")
    %>
    HAVE RESPECT FOR AS LONG AS.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •