farhad.k.t
چهارشنبه 05 شهریور 1393, 20:18 عصر
سلام دوستان
من تازه با Linq آشنا شدم و پروژه ای نوشتم که یک فرم نمایش و یک فرم ویرایش داره و وقتی Update_sp رو در فرم ویرایش اجرا می کنم و datacontext.submitchanges() را اجرا می کنم فرم ویرایش بسته می شه و سپس query show اجرا میشه و در dgv ریخته می شه...
ولی هیچ رکوردی update نمیشه تا فرم نمایش رو ببندم و دوباره باز کنم...
خودم فکر میکنم مشکل مربوط به قفل شدن db هنگام عملیات باشه ولی نمی دونم چطوری درستش کنم؟...
کد ها را برای بررسی بیشتر براتون می گذارم لطفا راهنمایی کنید...
کد مربوط به btn_edit در فرم نمایش:
editbookfrm frm = new editbookfrm();
frm.Text = "ویرایش کتاب";
frm.radif= Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);
frm.title = dataGridView1.CurrentRow.Cells[1].Value.ToString();
frm.author = dataGridView1.CurrentRow.Cells[2].Value.ToString();
frm.translator =Convert.ToString( dataGridView1.CurrentRow.Cells[3].Value);
frm.subject = dataGridView1.CurrentRow.Cells[4].Value.ToString();
frm.publicator = dataGridView1.CurrentRow.Cells[5].Value.ToString();
frm.publicationyear = dataGridView1.CurrentRow.Cells[6].Value.ToString();
frm.available = dataGridView1.CurrentRow.Cells[7].Value.ToString();
frm.description = Convert.ToString(dataGridView1.CurrentRow.Cells[8].Value);
frm.ShowDialog();
bookshowfrm_Load(sender, e);
کد مربوط به btn_save در فرم ویرایش:
dc.sp_tblbooks_update(radif, txttitle.Text, txtauthor.Text, txttranslator.Text, txtsubject.Text, txtpublicator.Text, txtpublicatonyear.Text, bool.Parse(cmbavailable.Text), txtdescription.Text);
dc.SubmitChanges();
this.Close();
من تازه با Linq آشنا شدم و پروژه ای نوشتم که یک فرم نمایش و یک فرم ویرایش داره و وقتی Update_sp رو در فرم ویرایش اجرا می کنم و datacontext.submitchanges() را اجرا می کنم فرم ویرایش بسته می شه و سپس query show اجرا میشه و در dgv ریخته می شه...
ولی هیچ رکوردی update نمیشه تا فرم نمایش رو ببندم و دوباره باز کنم...
خودم فکر میکنم مشکل مربوط به قفل شدن db هنگام عملیات باشه ولی نمی دونم چطوری درستش کنم؟...
کد ها را برای بررسی بیشتر براتون می گذارم لطفا راهنمایی کنید...
کد مربوط به btn_edit در فرم نمایش:
editbookfrm frm = new editbookfrm();
frm.Text = "ویرایش کتاب";
frm.radif= Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);
frm.title = dataGridView1.CurrentRow.Cells[1].Value.ToString();
frm.author = dataGridView1.CurrentRow.Cells[2].Value.ToString();
frm.translator =Convert.ToString( dataGridView1.CurrentRow.Cells[3].Value);
frm.subject = dataGridView1.CurrentRow.Cells[4].Value.ToString();
frm.publicator = dataGridView1.CurrentRow.Cells[5].Value.ToString();
frm.publicationyear = dataGridView1.CurrentRow.Cells[6].Value.ToString();
frm.available = dataGridView1.CurrentRow.Cells[7].Value.ToString();
frm.description = Convert.ToString(dataGridView1.CurrentRow.Cells[8].Value);
frm.ShowDialog();
bookshowfrm_Load(sender, e);
کد مربوط به btn_save در فرم ویرایش:
dc.sp_tblbooks_update(radif, txttitle.Text, txtauthor.Text, txttranslator.Text, txtsubject.Text, txtpublicator.Text, txtpublicatonyear.Text, bool.Parse(cmbavailable.Text), txtdescription.Text);
dc.SubmitChanges();
this.Close();