c# code
unknown
assembly_x86
4 years ago
1.7 kB
8
Indexable
if (name.Text == "" || mois.Text == "" || place.Text == "" || motifs.Text == "" || grade.Text == "")
{
MessageBox.Show("يرجى التحقق من إضافة جميع المعلومات الخاصة بالنشاط", "رسالة", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
cmd = new SqlCommand("insert_works", cn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter[] param = new SqlParameter[7];
param[0] = new SqlParameter("@name", SqlDbType.NVarChar, 50);
param[0].Value = name.Text;
param[1] = new SqlParameter("@section", SqlDbType.NVarChar, 50);
param[1].Value = grade.Text;
param[2] = new SqlParameter("@date_work", SqlDbType.Date);
param[2].Value = dtp1.Value.ToString();
param[3] = new SqlParameter("@place", SqlDbType.NVarChar, 50);
param[3].Value = place.Text;
param[4] = new SqlParameter("@remarque", SqlDbType.NVarChar, 50);
param[4].Value = motifs.Text;
param[6] = new SqlParameter("@responsable", SqlDbType.NVarChar, 50);
param[6].Value = responsable.Text;
param[6] = new SqlParameter("@mois", SqlDbType.NVarChar, 50);
param[6].Value = mois.Text;
cmd.Parameters.AddRange(param);
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
MessageBox.Show("تمت إضافة النشاط بنجاح", "رسالة", MessageBoxButtons.OK, MessageBoxIcon.Information);Editor is loading...