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

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

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