PDA

View Full Version : مبتدی: مشکل در کد آپدیت



civilmajor
شنبه 29 فروردین 1394, 13:45 عصر
لطفا ببینید مشکل این کد آپدیت بنده از کجاست که جواب نمیده و همه فیلدامو یک مشت اطلاعات نامفهوم ثیت میکنه و یا اصلا چیزی رو آپدیت نمی کنه
ممنون از توجهتون



OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" + Application.StartupPath + "\\PSWdb.accdb");
OleDbCommand com6 = new OleDbCommand();
com6.CommandType = CommandType.Text;

com6.CommandText = "update Others set Province='"+comboBoxMontakhab.Text+"',DegreeInProvince='"+comboBoxMaghamMontakhab.Text+"',Contry='"+comboBoxHozorKeshvar.Text+"',DegreeInContry='"+comboBoxMaghamKeshvar.Text+"',HomeWorkForm='"+txtFormManzel.Text+"',StudCoaporation='"+txtAmoozeshHamkari.Text+"',ParentCoaporation='"+txtHamkariParent.Text+"',SchoolVerification='"+txtRezayatMasoulin.Text+"',ParentVerification='"+txtRezayatParent.Text+"',ParentPresentation='"+txtPeygiriParent+"',LeisureCamp='"+txtOrduFun.Text+"',ProCamp='"+txtOrduFani.Text+"',MasterScore='"+txtMosbatManfi+"',OtherSuccesses='"+txtGheyrElmi.Text+"',Cup='"+txtLoh+"' where CodMelli6 = @5";

com6.Parameters.AddWithValue("@5", txtCodMelli.Text.ToString());

com6.Connection = conn;

try
{
conn.Open();
com6.ExecuteNonQuery();
conn.Close();
MessageBox.Show("ویرایش انجام شد.", "پیام PSW", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception e2)
{
MessageBox.Show(e2.Message);
}

amin2004
شنبه 29 فروردین 1394, 22:18 عصر
یکم نامرتبه