On 27 Oct, 17:13, "Paul W Smith" <p...@NOSPAM.twelve.me.ukwrote:
My application uses two ways to connect to the Access db:
Programtically:
Dim sDBPath = "Data Source=D:\MCCL\AccessDB\NewMCCL.mdb;"
Dim sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & sDBPath
Dim myConnection As New OleDbConnection(sConnString)
By Declaring:
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/NewMCCL.mdb"
SelectCommand="SELECT * FROM [web_MatchReportingByWeekID]">
</asp:AccessDataSource>
What entry do I put into my webconfig file so I can call it from within my
code?
How do I use this for both types of the above versions?
PWS
It appears from your two declarations that you have two copies of the
file NewMCCL.mdb in different locations.
Assuming that when you deploy the site it will be in "~/App_Data/
NewMCCL.mdb" it would be simpler to modify the code for sDBPath to:
sDBPath = "D:\Data Source=" & Server.MapPath("~/App_Data/
NewMCCL.mdb;")
Unless the datafile name is likely to change it isn't worth putting it
in web.config because the entries won't be the same for
AccessDataSource1 and MyConnection (the latter requires a full
connection string whereas the former only needs the datafile path).
HTH