web config file server.mappath error

ApplestoApples

New Member
Hi,<BR><BR>I have the following in web.config file<BR><BR><add key="test" value=http://aspmessageboard.com/archive/index.php/"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:inetpubwwwroot est est.mdb;/><BR><BR>web.config doesn't support server.mappath function, I will depoly the application to a remote host and I don't know the absolute path to point to the access database. how can I do it?<BR><BR>I use the following to set conneciton in vb file.<BR>Dim strConnection = ConfigurationSettings.AppSettings("test")<BR><BR>thanks in advance<BR>I just ran into this problem the other day. If you can put the mdb file in your app_data directory, then you can reference it the following way in your web.config:<BR><connectionStrings><BR> <add name="yourconnectionstring" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&#124DataDirectory&#124yourdb.mdb" providerName="System.Data.OleDb"/><BR> </connectionStrings><BR><BR>then in your .vb file you refer to it as<BR>Using myConnection As New _<BR>SqlConnection(ConfigurationManager.ConnectionStrin gs( _<BR> "yourConnectionString").ConnectionString)<BR>...command stuff, db operations...<BR>end using<BR>thank you very much for your help. It works perfectly.<BR><BR>I have tried to search the net for half an hour, unfortunately haven't got any positive solution.....<BR><BR>superb skills!<BR><BR>
 
Top