private void btnSave_Click(object sender, EventArgs e) { try { var dc = new ClassSRMDataContext(Config.connection); byte[] imageData = null; imageData = ReadImageFile(img.GetLoadedImageLocation()); dc.InsertStudent((int)cmbClass.EditValue, txtName.Text, txtLName.Text, txtFName.Text, cmbGender.Text, imageData); XtraMessageBox.Show("دانش آموز موردنظر با موفقیت ثبت شد", "توجه", MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Text = string.Empty; txtFName.Text = string.Empty; txtLName.Text = string.Empty; img.Image = null; txtName.Select(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "ClassSRM", MessageBoxButtons.OK, MessageBoxIcon.Error); } }