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
What is the difference between statement and preparedstatement interface?
What are the features of ado.net?
What is row state?
Is it possible to load multiple tables in a Dataset?
What are the different methods available under the sqlcommand class to access the data?
What is method to get XML and schema from Dataset? getXML() and get Schema ()
Define Execute Scalar?
What is ado.net components?
What does executenonquery () method return?
What is the difference between data reader and data adapter?
Explain the DataAdapter.Update() and DataSetAcceptChanges() methods.
What is ado full form?
Explain the difference between an ado.net dataset and an ado recordset?
What are the data access namespaces in .NET?
What is the current version of entity framework?