The example in this article describes how ASP.net connects to access through a configuration file. Share to everyone for your reference. The specific analysis is as follows:
Here the database Blog.mdb stored in the App_Data
Configuration file
<connectionStrings>
/Method one
<add name= "Access_conn" connectionstring= "provider=" Microsoft.jet.oledb.4.0;data source= "/> <add name=" Access_path "connectionstring=" "~/App_Data/blog.mdb"
>
/Method Two
<add name= "Blogconn" connectionstring= Provider=Microsoft.Jet.OLEDB.4.0;Data source=| Datadirectory|\\blog.mdb; Persist security info=true "/>
</connectionStrings>
Called in CS:
String sconn = "";
Call a
sconn = configurationmanager.connectionstrings["Access_conn"]. ConnectionString
+ HttpContext.Current.Server.MapPath (configurationmanager.connectionstrings["Access_path") . ConnectionString);
Call two
sconn = configurationmanager.connectionstrings["Blogconn"]. ConnectionString;
OleDbConnection conn = new OleDbConnection (sconn);
Conn. Open ();
I hope this article will help you with the ASP.net program design.