Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_database_setup thread: Connection to local dir


Message #1 by "Frode Strømme" <fstroemm@o...> on Fri, 15 Jun 2001 13:58:15
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\datastores\data.mdb"



works but not



"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data.mdb"





How do I set the directory to the root of my asp files?





Thanks.



- Frode





Message #2 by "Frode Strømme" <fstroemm@o...> on Fri, 15 Jun 2001 20:43:49
This one works:



VB_VB_STRCON = "Provider=Microsoft.Jet.OLEDB.4.0;Data 

Source=c:/datastores/ungdomdep.mdb" 



This one gives me an error:



VB_VB_STRCON = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & 

server.mappath("ungdomdep.mdb")



gives me:



Error Type:

Microsoft JET Database Engine (0x80040E09)

Cannot update. Database or object is read-only.





Anyone knows why?





> "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\datastores\data.mdb"

> 

> works but not

> 

> "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data.mdb"

> 

> 

> How do I set the directory to the root of my asp files?

> 

> 

> Thanks.

> 

> - Frode

> 

> 

Message #3 by "Ken Schaefer" <ken@a...> on Sun, 17 Jun 2001 20:40:23 +1000
Server.Mappath() returns the physical path of the supplied virtual path.



If you do this:



: VB_VB_STRCON = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &

: server.mappath("ungdomdep.mdb")



then the ASP page must be in the same directory as the database, since you

are asking for the physical path leading to the current directory.



I know this explanation probably isn't help much <grin>, so I'll give you

another. Suppose your webroot is c:\inetpub\wwwroot\

and you have a directory call \somedir\

and a page called page1.asp



Thus, you access this page as http://localhost/somdir/page1.asp



Now, if you have Server.Mappath("page1.asp") in page1.asp it will return:

c:\inetpub\wwwroot\somdir\page1.asp



Now, suppose you copy page1.asp to the webroot, so that you access it like:

http://localhost/page1.asp



Now, server.mappath("page1.asp") returns:

c:\inetpub\wwwroot\page1.asp



Unless you put some / into server.mappath, it will return the current

directory - make sure that the the database is in the same folder as the

actual ASP page, if you don't want to use /



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----

From: "Frode StrXmme" <fstroemm@o...>

To: "ASP Database Setup" <asp_database_setup@p...>

Sent: Friday, June 15, 2001 8:43 PM

Subject: [asp_database_setup] Re: Connection to local dir





: This one works:

:

: VB_VB_STRCON = "Provider=Microsoft.Jet.OLEDB.4.0;Data

: Source=c:/datastores/ungdomdep.mdb"

:

: This one gives me an error:

:

: VB_VB_STRCON = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &

: server.mappath("ungdomdep.mdb")

:

: gives me:

:

: Error Type:

: Microsoft JET Database Engine (0x80040E09)

: Cannot update. Database or object is read-only.

:

:

: Anyone knows why?

:

:

: > "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\datastores\data.mdb"

: >

: > works but not

: >

: > "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data.mdb"

: >

: >

: > How do I set the directory to the root of my asp files?

: >

: >

: > Thanks.

: >

: > - Frode

: >

: >

:

: ---

: STAY UP TO DATE ON ASP.NET, C#, VB.NET, SQL and XML

: Developersdex indexes over 100 of the top ASP, SQL, VB

: and XML sites bringing in more than 5,000 new resources

: every day.  They even integrate all the top .NET

: newsgroups so you can search/post/reply across

: multiple newsgroups within their site.  The next time

: you want to find an answer on ASP, C#, SQL, VB or XML

: think of Devdex!  http://www.developersdex.com/



ken@a...


$subst('Email.Unsub')




  Return to Index