General multiple database support is provided in the configuration file as follows:
Copy Code code as follows:
<connectionStrings>
<add name= "mycmsconnectionstring" connectionstring= "server= (local); user id=sa;pwd=123456;database=mycms;" />
</connectionStrings>
And the database connection is as follows:
Copy Code code as follows:
Using System;
Using System.Collections.Generic;
Using System.Text;
Using System.Configuration;
Using System.Data;
Using System.Data.Common;
Namespace COMMON
{
public class Class1
{
Public DbConnection getdatabaseconnection ()
{
Connectionstringsettings settings = configurationmanager.connectionstrings["Conn"];
DbProviderFactory factory = dbproviderfactories.getfactory (settings. ProviderName);
DbConnection conn = Factory. CreateConnection ();
Conn. ConnectionString = settings. ConnectionString;
Return conn;
}
}
}
But what happens next? Studied the Discuz and some other support for multiple database CMS, there are some ideas.