Himo Posted May 21, 2005 Posted May 21, 2005 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? Quote For questions about VS .net extensibility, please fire at me! :) For readability, please use the [ CS][/CS ] tags
Administrators PlausiblyDamp Posted May 21, 2005 Administrators Posted May 21, 2005 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;") Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Himo Posted May 22, 2005 Author Posted May 22, 2005 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 :) Quote For questions about VS .net extensibility, please fire at me! :) For readability, please use the [ CS][/CS ] tags
Administrators PlausiblyDamp Posted May 22, 2005 Administrators Posted May 22, 2005 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.