|
 |
ado_dotnet thread: I need help linking to "Access" database
Message #1 by "John Atkinson" <d.j.s.atkinson@c...> on Tue, 5 Feb 2002 21:43:28
|
|
Hi,
I can link to an access database in the development environment, by
creating a new database connection in the Server Explorer, and use it!
(using OleDB)- but the connection is to an access database in
C:\MyDouments.... which is no good for deploying on a server. I have
tried overwriting the code for the path - to a URL (localhost) but the
compiler complains.
Am I right in thinking that I cannot use an Access database in an ASP
application?
I would like to link to an access database i.e. File.mdb local to the ASP
application on the server. I don't have SQLServer, or any experience
using it, and for what I am trying to do I don't want to use it.
Any advice?
Thanks.
Message #2 by Imar Spaanjaars <Imar@S...> on Tue, 05 Feb 2002 22:47:14 +0100
|
|
You can't use an URL because the server will look for a file based path.
You can use the Server.MapPath() method to "translate" a URL / Virtual path
to a real path.
For example:
Dim sLocation as String
sLocation = Server.MapPath("/databases/myDatabase.mdb")
If your website is located at "C:\Inetpub\wwwroot\Myapp" for example,
sLocation in the example above will now contain:
"C:\Inetpub\wwwroot\Myapp\databases\myDatabase.mdb" which is what ADO.NET
can look for.
HtH
Imar
At 09:43 PM 2/5/2002 +0000, you wrote:
>Hi,
>
>I can link to an access database in the development environment, by
>creating a new database connection in the Server Explorer, and use it!
>(using OleDB)- but the connection is to an access database in
>C:\MyDouments.... which is no good for deploying on a server. I have
>tried overwriting the code for the path - to a URL (localhost) but the
>compiler complains.
>
>Am I right in thinking that I cannot use an Access database in an ASP
>application?
>
>I would like to link to an access database i.e. File.mdb local to the ASP
>application on the server. I don't have SQLServer, or any experience
>using it, and for what I am trying to do I don't want to use it.
>
>Any advice?
>Thanks.
Message #3 by "McCloy, Russell" <Russell.McCloy@B...> on Wed, 6 Feb 2002 09:28:31 +1100
|
|
he's right!
-----Original Message-----
From: Imar Spaanjaars [mailto:Imar@S...]
Sent: Wednesday, 6 February 2002 8:47 AM
To: ADO.NET
Subject: [ado_dotnet] Re: I need help linking to "Access" database
You can't use an URL because the server will look for a file based path.
You can use the Server.MapPath() method to "translate" a URL / Virtual path
to a real path.
For example:
Dim sLocation as String
sLocation = Server.MapPath("/databases/myDatabase.mdb")
If your website is located at "C:\Inetpub\wwwroot\Myapp" for example,
sLocation in the example above will now contain:
"C:\Inetpub\wwwroot\Myapp\databases\myDatabase.mdb" which is what ADO.NET
can look for.
HtH
Imar
At 09:43 PM 2/5/2002 +0000, you wrote:
>Hi,
>
>I can link to an access database in the development environment, by
>creating a new database connection in the Server Explorer, and use it!
>(using OleDB)- but the connection is to an access database in
>C:\MyDouments.... which is no good for deploying on a server. I have
>tried overwriting the code for the path - to a URL (localhost) but the
>compiler complains.
>
>Am I right in thinking that I cannot use an Access database in an ASP
>application?
>
>I would like to link to an access database i.e. File.mdb local to the ASP
>application on the server. I don't have SQLServer, or any experience
>using it, and for what I am trying to do I don't want to use it.
>
>Any advice?
>Thanks.
Message #4 by "John Atkinson" <d.j.s.atkinson@c...> on Fri, 8 Feb 2002 22:08:49
|
|
Thanks - I've solved my problem now with your help. I am using the
Developoment Studio.NET beta2 which has not been too useful, maybe they
are pushing SQL Server (who knows?). It seems is a DIY job to connect to
a MDB file on a server!
Bye.
> he's right!
>
> -----Original Message-----
> From: Imar Spaanjaars [mailto:Imar@S...]
> Sent: Wednesday, 6 February 2002 8:47 AM
> To: ADO.NET
> Subject: [ado_dotnet] Re: I need help linking to "Access" database
>
>
> You can't use an URL because the server will look for a file based path.
>
> You can use the Server.MapPath() method to "translate" a URL / Virtual
path
> to a real path.
>
> For example:
>
> Dim sLocation as String
> sLocation = Server.MapPath("/databases/myDatabase.mdb")
>
> If your website is located at "C:\Inetpub\wwwroot\Myapp" for example,
> sLocation in the example above will now contain:
> "C:\Inetpub\wwwroot\Myapp\databases\myDatabase.mdb" which is what
ADO.NET
> can look for.
>
> HtH
>
> Imar
>
>
>
> At 09:43 PM 2/5/2002 +0000, you wrote:
> >Hi,
> >
> >I can link to an access database in the development environment, by
> >creating a new database connection in the Server Explorer, and use it!
> >(using OleDB)- but the connection is to an access database in
> >C:\MyDouments.... which is no good for deploying on a server. I have
> >tried overwriting the code for the path - to a URL (localhost) but the
> >compiler complains.
> >
> >Am I right in thinking that I cannot use an Access database in an ASP
> >application?
> >
> >I would like to link to an access database i.e. File.mdb local to the
ASP
> >application on the server. I don't have SQLServer, or any experience
> >using it, and for what I am trying to do I don't want to use it.
> >
> >Any advice?
> >Thanks.
>
>
>
Message #5 by Imar Spaanjaars <Imar@S...> on Fri, 08 Feb 2002 23:24:35 +0100
|
|
From what I have seen so far, SQL Server is indeed pushed quite a lot. The
.NET Framework contains a lot of stuff optimized for SQL server. But
ADO.NET is still able to handle all kinds of datasources.
Maybe they assume knowledge of previous versions of ASP. The concept of
mapping a server path has been around for quite some time.
I always find msdn.microsoft.com a very helpful source to find answers to
questions like these.
Regards,
Imar
At 10:08 PM 2/8/2002 +0000, you wrote:
Thanks - I've solved my problem now with your help. I am using the
Developoment Studio.NET beta2 which has not been too useful, maybe they
are pushing SQL Server (who knows?). It seems is a DIY job to connect to
a MDB file on a server!
Message #6 by "Olav Benum" <wrox@b...> on Mon, 11 Feb 2002 17:25:34
|
|
> Thanks - I've solved my problem now with your help. I am using the
> Developoment Studio.NET beta2 which has not been too useful, maybe they
> are pushing SQL Server (who knows?).
No. Working with an Access database means in principle
working with an Access .mdb file. Just as editing a Word-document
means working with a .doc file. It has nothing to do with pushing
SQL Server. ( You dont give Word an URL when
you want to edit a file :-)
Olav
|
|
 |