//declaration of array of database name found in the web.config
string[] clients = {"database_name1", "database_name2"};
//database connection
foreach (var client in clients) { var db = Database.Open(client);//simple queryvar selectedClient = db.Query("SELECT * FROM DB2INST1.CUSTOMERS FETCH FIRST 1 ROWS ONLY"); }//display query@foreach(var row in selectedClient) { @row.CUSTOMERNAME}Compiler Error Message: CS0103: The name 'selectedClient' does not exist in the current context------------------But if i use directly the exact database name without the loop, the same code works.Example :var db = Database.Open("database_name1");I hope you can help me guys...Thank you
foreach (var client in clients) {
var db = Database.Open(client);
//simple query
var selectedClient = db.Query("SELECT * FROM DB2INST1.CUSTOMERS FETCH FIRST 1 ROWS ONLY");
}
//display query@foreach(var row in selectedClient) { @row.CUSTOMERNAME}Compiler Error Message: CS0103: The name 'selectedClient' does not exist in the current context------------------But if i use directly the exact database name without the loop, the same code works.Example :var db = Database.Open("database_name1");I hope you can help me guys...Thank you
//display query
@foreach(var row in selectedClient) { @row.CUSTOMERNAME}Compiler Error Message: CS0103: The name 'selectedClient' does not exist in the current context------------------
@foreach(var row in selectedClient) {
@row.CUSTOMERNAME
Compiler Error Message: CS0103: The name 'selectedClient' does not exist in the current context
But if i use directly the exact database name without the loop, the same code works.
Example :
var db = Database.Open("database_name1");
I hope you can help me guys...Thank you