c# - An expression of non-boolean type specified in a context where a condition is expected, near 'no' -


    private void button1_click(object sender, eventargs e)     {         cn.open();         st = "select * info roll_no=" + textbox1.text;         cmd = new sqlcommand(st,cn);         dr = cmd.executereader();         if(dr.read() == true)         {             textbox2.text = dr.getstring(1);             textbox3.text = dr.getstring(2).tostring();             textbox4.text = dr.getstring(3).tostring();             textbox5.text = dr.getstring(4).tostring();             textbox6.text = dr.getstring(5);              textbox1.focus();             button3.enabled = true;             button4.enabled = true;         }         else         {             messagebox.show("no such record exists");             textbox1.clear();             textbox1.focus();             button3.enabled = false;             button4.enabled = false;         }         dr.close();         cn.close();     } 

type query like: "select * info roll_no = '" + textbox1.text+'" ;"; hope helps.


Comments

Popular posts from this blog

apache - setting document root in antoher partition on ubuntu -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -