split some variables into one variable c#
i have a some variables like this
string cond;
if(cond1){
cond += "name=@name";
}
if(cond2){
cond += "age=@age";
}
if(cond3){
cond += "city=@city";
}
query="select * from students where"+string.Join(" and ",cond);
i want to do this
query="select * from students where if exists cond1 (cond) and if exists
cond2 (cond)";
i want split all conds into one variable with cond(and) .
No comments:
Post a Comment