If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > DB Connection

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-31-06, 12:34
onurkaya onurkaya is offline
Registered User
 
Join Date: Feb 2006
Location: Turkiye
Posts: 15
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.
Reply With Quote
  #2 (permalink)  
Old 04-01-06, 12:31
YeahWhat YeahWhat is offline
Registered User
 
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")
Reply With Quote
  #3 (permalink)  
Old 04-02-06, 07:40
onurkaya onurkaya is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On