If we want to connect to many databases in dataaccess layer
such as MSAccess,Sql server,oracle means not to a particular
database depends on condition we have to connect to
appropriate database in this scenario if we without changing
code Ho wdo you handle this situation?
Answer Posted / koteswara rao.chava
SqlConnection con;
protected void Page_Load(object sender, EventArgs e)
{
Get_Conn("TSQL");
//Get_Conn("ACCESS");
//Get_Conn("ORACLE");
}
protected void Get_Conn(string con_condition_Str)
{
switch (con_condition_Str)
{
case ("ACCESS"):
//SET CON = access constring
break;
case ("TSQL"):
// SET CON = SQL SERVER constring
break;
case ("ORACLE"):
// SET CON = ORACLE constring
break;
}
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
How does ado.net work?
What are the different row versions available in table?
Why is ADO.NET serialization slower than ADO ?
How to work with disconnected data - the dataset and sqldataadapter?
Explain why canot we use multiple inheritance and garbage collector paralelly in .net?
What is the difference between dataset and datatable?
Describe briefly an ADO.NET Dataset ?
What is the use of SqlCommand object?
What is executenonquery ado.net?
What is namespace in ado.net?
Explain all the classes those are used for database connections between sql server and asp.net?
Explain sqlconnection object?
What is the use of ADO.NET and XML web services?
What does executequery return?
How to pass multiple tables in datasets simultaneously?