modifying web.config
<appSettings>
<add key="Connection" value="2"/>
</appSettings>
<connectionStrings>
<add name="test" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\ShivaniSharma\Documents\transaction.accdb" />
</connectionStrings>
<pre lang="c#">
Business_layer.ClsMultiDB objMDB= new Business_layer.ClsMultiDB(2,ConfigurationManager.ConnectionStrings["test"].ConnectionString) ;
objMDB.update(Convert.ToDouble(txtAmt.Text), txtFrom.Text);
namespace Business_layer
{
public class ClsMultiDB
{
datalayer.DataLayer Objdl;
public ClsMultiDB(Int16 DbType, String ConnectionString)
{
Objdl = new datalayer.DataLayer(DbType, ConnectionString);
}
public void update(double bal, string acc)
{
int up = Objdl.DMLQuery("Update tblAccount set dbalance = dBalance - " + bal + " where AccNumber = '"
+ acc + "'");
}
namespace datalayer
{
public class DataLayer
{
public Int16 DLDBType = 0;
public String DLConnectionString = "";
public DataLayer(Int16 DbType,String ConnectionString)
{
if (DbType == 0)
{
}
else
{
DLDBType = DbType;
DLConnectionString = ConnectionString;
}
}
public int DMLQuery(String SqlCommandText)
{
int DMLValue = 0;
if (DLDBType == 1)
{
SQL ObjSQL = new SQL(DLConnectionString);
DMLValue= ObjSQL.DMLQuery(SqlCommandText);
}
if (DLDBType == 2)
{
msaccess Objms = new msaccess(DLConnectionString);
DMLValue = Objms.DMLQuery(SqlCommandText);
}
return DMLValue;
}
}
and create classes for SQL and msaccess class in datalater namespace to define connection........
hope it helps and if any suggestion always welcome