c# - having an issue using ExecuteScalar function in asp.net -


i trying use executescalar function checking backend table whether 1 of columns set “no”. if 1 of columns set no want call sendemail function, else want call delete_record function. problem is calling delete_record function , never calls sendemail function. data type post_id varchar , don’t know if has with; can’t seem figure out going on. can please help? here code:

sqlcommand cmd = new sqlcommand("select count(*) mytable post_id =@post_id , (column1='no' or column2='no' or column3='no')", con);     cmd.parameters.add("@post_id", sqldbtype.varchar).value = post_id;     cmd.connection = con;     con.open();     int32 result = (int)cmd.executescalar();      if (result == 1)     {         sendemail();     }       else      {        delete_record();      } 

since more one, should change condition to

    if (result >= 1)     {         sendemail();     }       else      {        delete_record();      } 

Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -