Hello guys,
I have a query and according to the result found, i am checking if it matches a specific string.(simple conditional statement)
Depending on its boolean value, i am assigning certain html to the variable and finally tring to display it on the interface.
The problem is that my query result is "NORTH" and my specific string is also "NORTH", so why it is not displaying.
Is there a problem with my conditional statement? beacause i have uses == and i am not sure if it is ok.
Can u please check it out. :( hop you can help me out. Below are the codes :
//defining variable
var flag = "";
//sql
var selectCustomers = db.Query("SELECT * FROM Customers");
//condition
Code
foreach (var row in selectCustomers) {Code
if (row.Customer_address == "NORTH") {Code
Flag = "OK";Code
} else if (row.Customer_address == "SOUTH") {Code
Flag = "NOK"; }Code
}Code
//Display in tableCode
td>@Html.Raw(processFlag)td>Code

Praveen DhatrikaRank #3,145 · 455 reputationPosted Feb 2, 2016, 7:35 AM EST
ashish sadasing22 reputationPosted Feb 2, 2016, 10:32 PM EST
Normally, the query "row.PRMVALUE" from the database is returning "POK".. and when i check if row.PRMVALUE == "POK", it should be validated to TRUE and proceed with the conditional statement below: processFlag = "OK";But the problem in my case is that it is entering in the else statement and finally displaying the following code on screen:NOK