c# - My search button not displaying data -


am building window form application clinic using vs2010. on form in have searchbutton display data baseon registrationno.
when test application, provide registration number , click search
button nothing display, , no error message display too.
here code

        string connectionstring = "data source=localhost;initial catalog=hms;persist security info=true;user id=developer;password=abc@123";         sqlconnection connection = new sqlconnection(connectionstring);          string selectstatement = "select * mytable registrationno = '@registraionno'";         sqlcommand insertcommand = new sqlcommand(selectstatement, connection);         insertcommand.parameters.addwithvalue("@registrationno", txtsearch.text);         sqldatareader reader;         try         {             connection.open();             reader = insertcommand.executereader();              while (reader.read())             {                 textbox3.text = reader["registrationo"].tostring();                 textbox1.text = reader["firstname"].tostring();                 textbox2.text = reader["lastname"].tostring();                 genderoption.text = reader["sex"].tostring();                 textbox7.text = reader["contact"].tostring();                 textbox4.text = reader["age"].tostring();                 textbox5.text = reader["weight"].tostring();                 textbox6.text = reader["weight"].tostring();                 combobox1.text = reader["tribe"].tostring();              }//end while             reader.close();         }         catch (sqlexception ex)         {             throw ex;          }//end catch                 {             connection.close();         }// end 

`

you have typo

registraionno instead of registrationno

in

string selectstatement = "select * mytable registrationno = '@registraionno'"; 

another in

textbox3.text = reader["registrationo"].tostring(); 

you'll copy 100 lines of

i want registration, want registration, want registration.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -