No value given for one or more required parameters. C# Oledb OledbConnectiom.

  • Thread starter Thread starter Prvz
  • Start date Start date
P

Prvz

Guest
i want to update a table Customer, and it throws this exception, "No value given for one or more required parameters."

can someboby tell me whats wrong with it.. I am using ms access.


f2.oleDbConnection1.Open();
OleDbCommand cmd = new OleDbCommand("Update Customer Set Cname=@Cname,City=@City,CAdddress=@CAddress,PH1=@PH1,PH2=@PH2,ContectPerson=@ContectPerson,CPPH=@CPPH,CEmail=@CEmail,CreditLimit=@CreditLimit,CStatus=@CStatus,CGroup=@CGroup Where CID='+comboBox2.Text'", f2.oleDbConnection1);

cmd.Parameters.AddWithValue("Cname", textBox34.Text);
cmd.Parameters.AddWithValue("City", textBox33.Text);
cmd.Parameters.AddWithValue("CAddress", textBox32.Text);
cmd.Parameters.AddWithValue("PH1", textBox31.Text);
cmd.Parameters.AddWithValue("PH2", textBox18.Text);
cmd.Parameters.AddWithValue("ContectPerson", textBox17.Text);
cmd.Parameters.AddWithValue("CPPH", textBox16.Text);
cmd.Parameters.AddWithValue("CStatus",textBox13.Text);
cmd.Parameters.AddWithValue("CEmail", textBox15.Text);
cmd.Parameters.AddWithValue("CreditLimit", textBox14.Text);
cmd.Parameters.AddWithValue("CGroup", textBox12.Text);
cmd.ExecuteNonQuery();
f2.oleDbConnection1.Close();

Continue reading...
 
Back
Top