My search button not displaying data

Am building window form application for a clinic using VS2010. On the form in have a searchbutton that display data baseon the RegistrationNo. When i test the application, provide the Registration number and click the search button nothing is display, and no error message is display too. Here is my 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 * FROM MyTable where 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
        finally
        {
            connection.Close();
        }// end finally

`

Answers


You have a typo

RegistraionNo instead of RegistrationNo

in

string SelectStatement = "SELECT * FROM MyTable where RegistrationNo = '@RegistraionNo'";

another in

textBox3.Text = reader["RegistratioNo"].ToString();

You'll copy 100 lines of

I want a registration, I want a registration, I want a registration.


Need Your Help

Convert html response to json

ruby-on-rails ruby json

I am trying to implement SMS API in rails, when I hit the API url I get following html response:

Array issue in rails and highcharts

ruby-on-rails highcharts

I'm having issues in display data from my array in the series section of my lazy highcharts code. The 'dates' variable works fine in the 'f.options[:xAxis][:categories] = dates' section, but comes up