Vtemplate was recently used in the project. Its datareadertag TAG provides the ability to directly access the database. Its internal parsing provides encapsulation of database connection operations. However, when accessing access, the relative path cannot be used. Therefore, locate the database operation file and find the getdatasource () method in the datareadertag class.
Add
String STR, str2, str3;
STR = str2 = str3 = Setting. connectionstring;
If (setting. providername = "system. Data. oledb ")
{
System. Web. UI. Page page = new system. Web. UI. Page ();
Str2 = Str. substring (Str. indexof ("app_data "));
STR = page. server. mappath (str2 );
Str3 = str3.replace (str2, STR );
Dbconnection. connectionstring = str3;
}
Else
{
Dbconnection. connectionstring = Setting. connectionstring;
}
In this way, you can use the relative path in the configuration file for normal access.