ASP.NET/C# Problem connecting to a remote database

P

Paul Ballatti

hi,

I am attempting to update two databases simultaneously, from one
ASP.NET Web Application, which is written in C#. One database is
local i.e. on my localhost IIS and this has no problems at all. I
uploaded the same database file to my web server and I am having
problems trying to connect to it.

The errors I was getting included "could not lock file", "Cannot open
database ''. It may not be a database that your application recognizes
or the file maybe corrupt". I think my problem lies in the connection
string, because I am unsure of the data source I have to write in
order to connect to my database.

e.g. say the database is at http://www.mywebsite.com/mydb.mdb how is
this written into a connection string? I included it as it is seen
here and it errored saying the UDI format is not supported.

To check if it was the web server, I hosted the database on a friend's
IIS and tried to connect to that, but I have a similar problem with
the connection string and this time the errors are saying that my
source is not a valid file name.

Sorry for the long post and help is much appreciated.

Thanks
Paul Ballatti
 
B

Brendan Reynolds

It needs to be a file path (e.g. "C:\SomeFolder\SomeFile.mdb") not a URL
like "http:// ... " etc.

The 'could not lock file' and 'cannot open database' error messages indicate
that the data source you were using in the connection string when you
received those particular error messages was correct - the data provider was
finding the database in the specified location, but was unable to open it.
The most likely cause is that the account under which the ASP.NET
application is running doesn't have the necessary permissions on that
folder. I use Brinkster as my hosting service, and with Brinkster each user
is given one folder with the necessary permissions, and all MDBs must be
placed in that folder. Your hosting service probably has similar
restrictions, but you really need to talk to your hosting service to find
out exactly what they are.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top