aspx pages trying to connect to Access MDB Database

HI

Im trying to connect to an access MDB using an aspx page and VB.NET

The application works on my local machine but it wont work once I upload to the webserver

The database connection code is as follows at present

Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\custsupport\database\data.mdb"
        Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)

When I upload to the webserver I change the connection - .....Data Source=custsupport/database/data.mdb

So this fits in with the domain layout = http://www.mydomain.co.uk/custsupport/database/data.mdb

however I keep getting errors from the server as it cant find the file in the path

Error =

'c:\windows\system32\inetsrv\custsupport\database\data.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

Can anyone help me as I really dont know where to go from here

Regards

KevNet
LVL 5
KevNetAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
Hi KevNet,

Use:

Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=" & Server.MapPath("custsupport/database/data.mdb")

This will get the "Real" file location relative to the webserver from the path you have specified.

Tim Cottee
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KevNetAuthor Commented:
Cool - thanks for the help all working now!

Something I will def not forget how to do!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.