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 can we add relation between tables in a dataset?

555


what is the difference betwen typed dataset and untyped dataset?in general which dataset can we use in programming?

546


Explain the difference in record set and dataset?

501


How to connect and retrieve data from database using dataset

545


What provider ado.net use by default? Explain the role of data provider in ado.net? What is the role of data provider in ado.net?

543






How to pass multiple tables in datasets simultaneously?

580


What is the provider being used to access oracle database?

509


Which is the feature of ado.net?

532


What are good ado.net object to replace to ado recordset object.

576


What is the difference between executenonquery () and executescalar ()?

500


Which is faster dataset or datareader?

537


What is meant by executenonquery?

535


What are two important objects of ADO.Net?

560


How to identify the updated rows in a dataset?

529


Give an example that shows how to execute a stored procedure in ado.net?

578