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 > Connect Code

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-09-04, 10:52
Shashant Shashant is offline
Registered User
 
Join Date: Nov 2003
Location: Philadelphia
Posts: 9
Connect Code

<%
dim DbPath, ConnStr, myConn
DbPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security Info=False;" & "Data Source=" & Server.MapPath("../database/web.mdb")
MyConn.Open ConnStr <--- line 149

sqlName = "SELECT * FROM Table_Name"

set rsName= Server.CreateObject("ADODB.RecordSet")
rsName.Open sqlName, myConn

rsName.Close
set rsName = nothing

MyConn.Close
%>

Can you guys please help me out. I am getting this error:

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/Webproject/index.asp, line 149

I have been working on this for soo long, I have been having trouble conecting to the database, if there is other code that would be easier, please let me know. Thank you.
Reply With Quote
  #2 (permalink)  
Old 02-09-04, 11:51
Shashant Shashant is offline
Registered User
 
Join Date: Nov 2003
Location: Philadelphia
Posts: 9
Re: Connect Code

OK seems like I forgot to add Server.CreateObject("ADODB.Connection"). After I did that I get an unusual error.

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.

/WebProject/index.asp, line 149

Here is my code:

<%
dim DbPath, MyConn
DbPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("/database/web.mdb") <---line 149

sqlName = "SELECT * FROM Table_Name"

set rsName= Server.CreateObject("ADODB.RecordSet")
rsName.Open sqlName, myConn

rsName.Close
set rsName = nothing

MyConn.Close
%>





Quote:
Originally posted by Shashant
<%
dim DbPath, ConnStr, myConn
DbPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security Info=False;" & "Data Source=" & Server.MapPath("../database/web.mdb")
MyConn.Open ConnStr <--- line 149

sqlName = "SELECT * FROM Table_Name"

set rsName= Server.CreateObject("ADODB.RecordSet")
rsName.Open sqlName, myConn

rsName.Close
set rsName = nothing

MyConn.Close
%>

Can you guys please help me out. I am getting this error:

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/Webproject/index.asp, line 149

I have been working on this for soo long, I have been having trouble conecting to the database, if there is other code that would be easier, please let me know. Thank you.
Reply With Quote
  #3 (permalink)  
Old 02-09-04, 14:25
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Where is your database folder? I think the problem may occur in the code Server.MapPath("/database/web.mdb"). You can put the physical directory on the server instead of using Server.MapPath("/database/web.mdb").

The following link may be helpful for you to use the function.

http://msdn.microsoft.com/library/de...om_serommp.asp
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