Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want to access an MS access database on my localhost, but when I'm using this connection string:

String sConnString = "Driver={MS Access Driver (*.mdb)};Dbq=http://localhost/WebApplication1/bin/users.mdb;";

It just won't work, saying: Invalid filename

What could I do about it?

For questions about VS .net extensibility, please fire at me! :)

For readability, please use the [ CS][/CS ] tags

  • Administrators
Posted

For that to work the .mdb file would be accessible to everyone from the url - not a secure option. Plus unless you are using something like WebDAV it would not be treated like a normal file anyway.

What you will need to do is get the filename at runtime via Server.MapPath(...)

e.g.

String ConnString = "Driver={MS Access Driver (*.mdb)};Dbq=" + Server.MapPath("bin/users.mdb;") 

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

2 questions then:

 

1) WebDAV?

2) How could I configure SQL Server then correctly to do this? I couldn't figure out the hostname, since he wouldn't take 'localhost'.

 

Thank you very much already :)

For questions about VS .net extensibility, please fire at me! :)

For readability, please use the [ CS][/CS ] tags

  • Administrators
Posted

http://www.webdav.org/

 

If you are using SQL server then you would have a totally different connection string anyway - you would not be connecting direct to a file.

However if SQL is on the same server you could get away with something like Data Source=(local) to identify the server.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...