دروود به همه دوستان ...
من وقتی که می خوام یک کارمند رو داخل دیتا بیس خودم ثبت کنم همنون خطای incorrect near syntex '@a9 ' از می گیره دوستان کمکم کنید ممنون میشم چون مربوط میشه به پروژه پایان ترم
privatevoid radButton1_Click(object sender, EventArgs e)
{
SqlDataAdapter adp1 = newSqlDataAdapter("Select personelid from personel", logform.con);
DataSet dst1 = newDataSet();
DataView dtv1 = newDataView();
adp1.Fill(dst1,"personel");
dtv1 = dst1.Tables["personel"].DefaultView;
dtv1.Sort = "personelid";
if (dtv1.Find(txtcodek.Text) < 0)
{
if ((txtadd.Text != "") && (txtchild.Text != "") && (txtcodek.Text != "") && (txtdatev.Text != "") && (txtname.Text != "") && (txtpricek.Text != "") && (txttell.Text != ""))
{
logform.con.Open();
SqlCommand com1 = newSqlCommand("insert into personel (personelname,personelid,dateenter,address,tel,dat eburn,type,numberchild,priceworkfix)Values(@a1,@a2 ,@a3,@a4,@a5,@a6,@a7,@a8,@a9", logform.con);
com1.Parameters.AddWithValue("@a1", txtname.Text);
com1.Parameters.AddWithValue("@a2", Convert.ToInt32(txtcodek.Text));
com1.Parameters.AddWithValue("@a3", Convert.ToDateTime(txtdatev.Text));
com1.Parameters.AddWithValue("@a4", txtadd.Text);
com1.Parameters.AddWithValue("@a5", Convert.ToInt64(txttell.Text));
com1.Parameters.AddWithValue("@a6", Convert.ToDateTime(txtdateb.Text));
com1.Parameters.AddWithValue("@a7", Convert.ToString(radDropDownList1.SelectedItem));
com1.Parameters.AddWithValue("@a8", Convert.ToInt32(txtchild.Text));
com1.Parameters.AddWithValue("@a9", Convert.ToInt32(txtpricek.Text));
com1.ExecuteNonQuery();
logform.con.Close();
txtadd.Text = "";
txtchild.Text = "";
txtcodek.Text = "";
txtdatev.Text = "";
txtname.Text = "";
txtpricek.Text = "";
txttell.Text = "";
RadMessageIcon Icon = RadMessageIcon.Question;
RightToLeft rtl = newRightToLeft();
RadMessageBox.Show(this, "آیا شما مطمئن هستید که میخواهید کاربر را حذف کنید ؟", "اطمینان", MessageBoxButtons.YesNo, Icon, MessageBoxDefaultButton.Button1, rtl);
}
else
{
DialogResult msg1;
msg1 = MessageBox.Show("اطلاعات را کامل وارد کنید", "پیغام خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
DialogResult msg2;
msg2 = MessageBox.Show("کدکارمندی وارد شده تکراری می باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtcodek.Text = "";
}