Re: ASP.NET and OleDbConnection
- From: rajeshseetharam <rajeshseetharam.1q7621@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 6 Jun 2005 02:20:33 -0400
Hi
instead of
dbStr = Server.MapPath("../TestDatabase.mdb")
use
dbStr = Server.MapPath("\TestDatabase.mdb")
if your mdb file is directly under wwwroot then it should be \*.mdb
file or else it should be
\foldername\*.mdb, plz try this
rgds
Rajesh
vMike Wrote:
> Try something like this.
>
> path.getpathroot(server.mappath(1)) & the rest of you path to db.
>
> "trevor oakley" <to006e7245@xxxxxxxxxxxxxxxx> wrote in message
> news:CMNJa.565$5E.395@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > This is a repost, after people said this group is the suitable for
> ASP.NET
> > comments.
> >
> >
> > I am working through Teach Yourself ASP.NET in 21 Days (Day10), and
> I
> > have hit a problem with OleDbConnection. Maybe someone here knows a
> > lot of connections to databases in ASP.NET, and is willing to share
> > their knowledge.
> >
> > I am trying
> >
> > dbStr = Server.MapPath("../TestDatabase.mdb")
> > Response.write("db string " & dbStr)
> >
> > objConnection = New
> > OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" _
> > & " Data Source=" & dbStr & ";")
> >
> > but it fails, with an error on the path (cannot exit above top
> > directory).
> >
> > The actual databases at hostway.com are stored above www so that
> they
> > cannot be hacked using a browser. But the path seems to expect the
> > root directory as seen by the browser. It works it I take out the
> ../
> > and move my database to the www directory.
> >
> > Directory structure seen at FTP logon
> >
> > www --> alias to browser accessible pages, eg www.domain.com
> > Database --> cannot be viewed from a browser, to stop hacking
> > Logs
> >
> > All this works with Server.CreateObject in ASP.
> >
> > Can anyone help?
> >
> >
> >
--
rajeshseetharam
------------------------------------------------------------------------
rajeshseetharam's Profile: http://www.hightechtalks.com/member.php?userid=8
View this thread: http://www.hightechtalks.com/showthread.php?t=92982
.
- Prev by Date: Re: How to get values of a textbox in a datagrid?
- Next by Date: OWC10.ChartSpaceClass.ExportPicture - Access Denied Error
- Previous by thread: cannot see wsdl file in .NET or in IE
- Next by thread: OWC10.ChartSpaceClass.ExportPicture - Access Denied Error
- Index(es):
Relevant Pages
|