No value given for one or more required parameters with C#
<p>there was no No value given for one or more required parameters for the mycommand.ExecuteNonQuery()...
I wonder what is the problem...
May anyone help?
thx =)</p>

<pre><code>System.Data.OleDb.OleDbConnection cnregister;
    System.Data.OleDb.OleDbCommand cnUpreg;
    System.Data.OleDb.OleDbDataReader ReaderReg;
    private void cmdregister_Click(object sender, EventArgs e)
    {
        cnregister = new System.Data.OleDb.OleDbConnection();
        string connectionString = "Provider=Microsoft.Jet.OleDb.4.0; Data Source=|DataDirectory|Register.mdb";
        OleDbConnection myConnection = new OleDbConnection(connectionString);

        string InputId_reg;
        string InputPass_reg;
        InputId_reg = txtuserid_reg.Text;
        InputPass_reg = txtpass_reg.Text;
        myConnection.Open();


        OleDbCommand cnUpreg = new OleDbCommand("SELECT * FROM tblRegister", myConnection);

        ReaderReg = cnUpreg.ExecuteReader();     //reader open
        while (ReaderReg.Read())
        {
            if (InputId_reg == (ReaderReg["UserID"].ToString()) )
            {   //to check whether the UserID is same with the ID in the database
                // if yes, a message box will promt                 
                MessageBox.Show("The user had register");
                txtuserid_reg.Focus();
                txtuserid_reg.Clear ();
                ReaderReg.Close();
                myConnection.Close();
                break;

            }
            else
            {

                string query123 = "INSERT INTO [tblRegister] ([UserID], [Password], [UserName], [UserJob]) VALUES(add1, add2, add3, add4)";
                OleDbCommand mycommand = new OleDbCommand(query123, myConnection);

                mycommand.Parameters.AddWithValue("add1", txtuserid_reg.Text);
                mycommand.Parameters.AddWithValue("add2", txtpass_reg.Text);

                mycommand.ExecuteNonQuery();
                ReaderReg.Close();

                myConnection.Close();
                MessageBox.Show("Data save successfully!");
                break;


            }

        }

        MessageBox.Show("Break succesffully");
    }
}
</code></pre>
