PDA

View Full Version : سوال: مشکل دستور آپدیت



golhay2
دوشنبه 17 مرداد 1390, 16:47 عصر
با سلام من از کد زیر برای آپدیت استفاده می کنم ولی ارور می ده و می گه که چند تا از فیلدها مقدار ندارند در حالی که همه فیلدها مقدار دارند لطفا راهنمائی کنید
DataBase db = new DataBase();
long i;
i = Int32.Parse(txtparvanehno.Text);
db.DoCommand("update vakil set [comment]='" + txtcomment.Text + "',[sabeghe]='" + txtsabeghe.Text + "',[tel]='" + txttel.Text + "',[address]='" + txtaddress.Text + "',[work]='" + txtwork.Text + "',[father]='" + txtfather.Text + "',[nickname]='" + txtshohrat.Text + "',[family]='" + txtfamily + "',[name]='" + txtname.Text + "',[id]=5 where parvanehno = i");
Form_kala_Load(sender, e);
MessageBox.Show("ویرایش با موفقیت انجام شد");

Reza_Yarahmadi
دوشنبه 17 مرداد 1390, 18:52 عصر
متن کامل خطا رو بذارید تا بهتر بشه کمکتون کرد
ولی کدی که گذاشتید مشکلش توی بخش آخرشه ، متغیر i رو توی رشته SQL بردید بصورت زیر تغییرش بدید.
db.DoCommand("update vakil set [comment]='" + txtcomment.Text +
"',[sabeghe]='" + txtsabeghe.Text +
"',[tel]='" + txttel.Text +
"',[address]='" + txtaddress.Text +
"',[work]='" + txtwork.Text +
"',[father]='" + txtfather.Text +
"',[nickname]='" + txtshohrat.Text +
"',[family]='" + txtfamily +
"',[name]='" + txtname.Text +
"',[id]=5 where parvanehno = " + i);