Hi, I have an Access database which I open using a connectionstring (DNS= too much hassle).
The connection string needs to know the absolute path to the database file and the only way I can find it is by doing a bit of string manipulation.
The example below is called by a file in a folder called admin and my database is in a folder called
_database which is at the same level as my admin folder.
This code works fine but it seems a little longwinded.Code:Dim dBaseLocation As String ' Get the absolute path to the Admin folder then replace the Admin folder with an empty string. Also concatenate the _database folder and database name to give me the absolute path to the folder. dBaseLocation = Replace(Server.MapPath(""), "Admin", "") & "\_database\databasestore_be.mdb" ' Just in case dBaseLocation = Replace(dBaseLocation, "\\", "\")
I see that the system.IO space includes a Path class. I tried a few of the methods of this class but never achieved what the above bit of spaghetti code did.
Does anyone have a better way of doing the above?
Cheers
MarkusJ


Reply With Quote
