case statement in sql command in aspx file
-
How to write case statment with sql query in code behind file that is file.cs ....please help me out. Thanks
-
How to write case statment with sql query in code behind file that is file.cs ....please help me out. Thanks
The same way you'd write any other SQL query in the code-behind.
using (SqlConnection connection = new SqlConnection("YOUR CONNECTION STRING"))
using (SqlCommand command = new SqlCommand("SELECT CASE WHEN @Flag = 1 THEN 'Yes' ELSE 'No' END FROM YourTable", connection))
{
command.Parameters.AddWithValue("@Flag", true);
...
}If you want a more detailed answer, then you're going to have to provide a more detailed question.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer