I am getting error as "No values given for one or more required parameters" Please help. For Nid.Text value is "N712".

  private void Form1_Load(object sender, EventArgs e)
            OleDbConnection cont1 = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\vsual\Database3.accdb");
            OleDbCommand cmd1 = new OleDbCommand("select distinct UserName from Users where UID=@UID ", cont1);
            OleDbCommand cmd2 = new OleDbCommand("select distinct QueueName from Users where UID=@UID ", cont1);
            OleDbCommand cmd3 = new OleDbCommand("select * from Issues", cont1);
            cmd1.Parameters.AddWithValue("@UID", Nid.Text);
            cmd2.Parameters.AddWithValue("@UID", Nid.Text);
            OleDbDataReader rdr1= cmd1.ExecuteReader();
                txtName.Text = rdr1[0].ToString();
            OleDbDataReader rdr2 = cmd2.ExecuteReader();
            while (rdr2.Read())
                txtQueue.Text= rdr2[0].ToString();
            txtName.Enabled = false;
            txtQueue.Enabled = false;

            OleDbDataAdapter da = new OleDbDataAdapter();
            DataSet ds = new DataSet();
            da.SelectCommand = cmd3;
            cmbIssue.DataSource = ds.Tables[0];
            cmbIssue.ValueMember = "Issues";
            cmbIssue.DisplayMember = "Issues";
            cmbIssue.Enabled = true;


All i got from internet is some issue with sql statement. Please help me out to resolve this issue.

Related posts

Recent Viewed