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
Explain the difference between an ado.net dataset and an ado recordset?
How can we perform transactions in .net?
What is difference between executenonquery and executequery?
What is ado in agriculture?
What is connection string?
Explain the difference between sqlcommand object and command behavior object?
What are the types of databinding?
how you will deal result set? How do you sort a dataset?If a dataset contains 100 rows, how to fetch rows between 5 and 15 only?
List the 4 common ado.net namespaces?
What does sqldatareader return?
What property must be set and what method must be called in your code to bind the data from some data source to the Repeater control?
Which database is the ado.net?
Which method is used by command class to execute SQL statements that return single value?
What are good ado.net object to replace to ado recordset object.
What is the difference between data reader and data adapter?