if condition in asp.net

Posted by Dn2010 under ASP.NET on 4/5/2012 | Points: 10 | Views : 2138 | Status : [Member] | Replies : 1
hi friends,


how to write if condition

if Label1.Text is empty

string CommandText = "select * from emp Order By calldate desc limit 20";

otherwise run this

string CommandText = "select * from empOrder By calldate desc limit 20 WHERE calldate > '" + Label1.Text + "' Order By calldate desc limit 20";

please give the code for it

thanks.




Responses

Posted by: Savariya on: 4/5/2012 [Member] Starter | Points: 25

Up
0
Down

string CommandText="";
if Label1.Text.Len==0)
{
CommandText = "select * from emp Order By calldate desc limit 20";
}
else
{
CommandText = "select * from empOrder By calldate desc limit 20 WHERE calldate > '" + Label1.Text + "' Order By calldate desc limit 20";
}



Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response