code not working within if clause

Jun 22 2024 12:50 PM

        var token = UrlData[1];

        var phone_no = UrlData[0];
        var db = Database.Open("school");
        var rquery = "select  st.acno, st.name, sd.cclass, sd.section, cl.nclass from student st join stud sd " +
              "on st.acno = sd.acno join clist cl on cl.ccode = sd.cclass" +
             " where st.otele like '%" + phone_no.ToString() + "%' ";

        if (1 > 0) {
            var data = db.Query(rquery);
        }
        db.Close();

This code runs fine if I remove the if clause. With the If clause, however basic, I get an error. This a webpages projecct.

Answers (2)