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


Please Help Members By Posting Answers For Below Questions

How do you update database through dataset?

713


What is ado.net architecture?

661


What are the benefits of using of ADO.NET in .NET 4.0?

726


What is sqldatasource?

691


What is the namespaces being used to access oracle database?

718


How do you update a dataset in ado.net?

745


What is a column variable?

673


What is the use of SqlCommand object?

856


Explain the role of data provider in ado.net?

730


What is ole word?

719


Why do we serialize data?

686


What are all the classes that are available in System.Data Namespace?

747


What is a string variable?

643


What is untyped dataset?

768


Can we connect two dataadapters to same data source using single connection at same time?

730