navya b

navya b

  • NA
  • 42
  • 14k

err: column name or number of supplied values does not match

Jun 22 2015 2:25 AM
i was getting an error :Column name or number of supplied values does not match table definition.
Line 23: cmd.ExecuteNonQuery();
-------------------
this is my c# code
protected void Button1_Click(object sender, EventArgs e)
{
 
string gend = RadioButtonList1.SelectedItem.ToString();
con.Open();
 
SqlCommand cmd = new SqlCommand("INSERT into OwnerReg VALUES('" + TextBox1.Text + "',
'"
+ TextBox2.Text + "', '" + TextBox7.Text + "',
'"
+ gend + "','" + TextBox3.Text + "','" + TextBox4.Text + "',
'"
+ TextBox5.Text + "','" + TextBox6.Text + "')", con);
cmd.ExecuteNonQuery();
con.Close();
 
Label16.Text = "Registered Successfully....";
 
}
--------------------------------------------------------
 
Data base table: OwnerReg
 
Username nvarchar(50),Password nvarchar(50),ConfirmPassword nvarchar(50),Gender nvarchar(50),DOB nvarchar(50),
Email nvarchar(MAX),MobileNO nvarchar(50),Address nvarchar(MAX)
 
plz help me...
 
 
 
 

Answers (5)