Hi, just a little something on this Server.MapPath thingy:
Server.MapPath returns the physical file path that corresponds to the specified virtual path on the Web server.
This is useful (in fact is obligatory) in cases where the data source is not in the same directory as the calling page. Dave's logic might have been better seen as follows:
The physical path to the data source in your local drive may not be the same physical path on the Web server, even if your local web has the same exact file structure as your web on the remote machine, as the mapping or assignment of the virtual root of your web app in your local host may not be the same as on the remote server.
For instance, the files for my site are physically located at c:\aspxtreme in my local machine.
In aspalliance.com (the mother site of aspxtreme), all columnists' virtual directories are physically located on d:\domains\aspalliance.com\ plus the name of the columnist's virtualdir . . . (in my case, aspxtreme)
Using Server.MapPath with the specified virtual path, for example:
/aspxtreme/shared/data/whatever.mdb
ensures that the data source would be referenced correctly whether I am working locally or on the remote. :)
No offense, whammy but that code at brinkster is totally unnecessary. A simple Server.MapPath that points to your data source as seen from your virtual root will do. For example, this alone will work:
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("/virtualroot/subdir/whatever.mdb") :D
Hello justame.