bargesabz
سه شنبه 31 شهریور 1388, 18:33 عصر
با سلام به همه دوستان
هنگام درج یک رکورد با دستور زیر
case 1:
noehedye = '2';
SqlCommand hcom = new SqlCommand("INSERT INTO Hedye( nkhayyer,noehedye,fkhayyer,dtahvil,babate,daryafko nande,numresid,elamevosol,shfanbar,codkala,namekal a,vahedkala,mvarede,bvahed,mablaqhkol)"
+ "VALUES('" + textBox2.Text + "','" + noehedye + "','" + textBox3.Text + "','" + textBox1.Text + "','" + textBox12.Text + "','" + textBox13.Text + "','" + textBox11.Text + "','" + comboBox4.Text + "','" + textBox8.Text + "','" + textBox6.Text + "','" + textBox4.Text + "''" + comboBox3.Text + "','" + textBox5.Text + "','" + textBox7.Text + "','" + textBox14.Text + "')", hemophili);
hemophili.Open();
hcom.ExecuteNonQuery();
MessageBox.Show("رکورد ذخیره شد");
error زیر رو در خط
hcom.ExecuteNonQuery(); می ده
There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
فکر می کنم که این خطا می گه که تعداد عناصر در بند insert باید با تعداد عناصر در بندvalues برابر باشه
و تعدادشون برابره پس مشکل از کجاست؟
هنگام درج یک رکورد با دستور زیر
case 1:
noehedye = '2';
SqlCommand hcom = new SqlCommand("INSERT INTO Hedye( nkhayyer,noehedye,fkhayyer,dtahvil,babate,daryafko nande,numresid,elamevosol,shfanbar,codkala,namekal a,vahedkala,mvarede,bvahed,mablaqhkol)"
+ "VALUES('" + textBox2.Text + "','" + noehedye + "','" + textBox3.Text + "','" + textBox1.Text + "','" + textBox12.Text + "','" + textBox13.Text + "','" + textBox11.Text + "','" + comboBox4.Text + "','" + textBox8.Text + "','" + textBox6.Text + "','" + textBox4.Text + "''" + comboBox3.Text + "','" + textBox5.Text + "','" + textBox7.Text + "','" + textBox14.Text + "')", hemophili);
hemophili.Open();
hcom.ExecuteNonQuery();
MessageBox.Show("رکورد ذخیره شد");
error زیر رو در خط
hcom.ExecuteNonQuery(); می ده
There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
فکر می کنم که این خطا می گه که تعداد عناصر در بند insert باید با تعداد عناصر در بندvalues برابر باشه
و تعدادشون برابره پس مشکل از کجاست؟