public ProfilePsychoForm(ChildDBConnect newDbCon, int idSpec, string typeDoc, DataRow selRow) { InitializeComponent(); this.selRow = selRow; pd = new PsychoData(); this.IsNew = false; this.dbCon = newDbCon; this.idSpec = idSpec; this.typeDoc = typeDoc; tbName.Text = selRow["name"].ToString(); // mtbDateDoc.Text = selRow["date_doc"].ToString(); dtDateDoc.Text = selRow["date_doc"].ToString(); if (selRow["psycho_doc"] == null) { bnOpen.Enabled = false; } else if (!Convert.IsDBNull(selRow["psycho_doc"])) { bufferDoc = (Byte[])selRow["psycho_doc"]; //System.DBNull } else { bnOpen.Enabled = false; } }
private void SetRowData(PsychoData pd, DataRow row) { row["psycho_doc"] = pd.psycho_doc; row["date_doc"] = pd.date_doc; row["name"] = pd.name; row["id_spec"] = pd.id_spec; row["type_doc"] = pd.type_doc; }
public ProfilePsychoForm(ChildDBConnect newDbCon, int idSpec, string typeDoc) { InitializeComponent(); pd = new PsychoData(); this.IsNew = true; this.dbCon = newDbCon; this.idSpec = idSpec; this.typeDoc = typeDoc; bnOpen.Enabled = false; }
public Boolean SavePsychoData(PsychoData pd, DataRow afRow) { try { OleDbCon.Open(); DataTable dt = sprSet.Tables["spec_psycho"]; SetRowData(pd, afRow); dataAdapter.Update(sprSet, "spec_psycho"); OleDbCon.Close(); return(true); } catch (Exception e) { OleDbCon.Close(); MessageBox.Show(e.Message, "Ошибка"); return(false); } }
public Boolean SavePsychoData(PsychoData pd) { try { OleDbCon.Open(); DataTable dt = sprSet.Tables["spec_psycho"]; DataRow newRow = sprSet.Tables["spec_psycho"].NewRow(); SetRowData(pd, newRow); sprSet.Tables["spec_psycho"].Rows.Add(newRow); //Обновим данные таблицы в БД dataAdapter.Update(sprSet, "spec_psycho"); //Обновим содержимое таблицы из БД в памяти sprSet.Tables["spec_psycho"].Clear(); dataAdapter.Fill(sprSet, "spec_psycho"); OleDbCon.Close(); return(true); } catch (Exception e) { OleDbCon.Close(); MessageBox.Show(e.Message, "Ошибка"); return(false); } }