m (DataBase db)
{(); _db = db;
} void TypeTovForm_Load (object sender, EventArgs e)
{_db.ReadDataBase (dgvTTov, "Select * from type_tovara");. Columns [0]. ReadOnly = true; _TTovCountStart = dgvTTov.RowCount - 1;
} void btnEdit_Click (object sender, EventArgs e)
{
// Всі старі записи, які змінили (int i = 0; i
{
// _db.WriteDataBase ("Update type_tovara Set opisanie = '" + dgvTTov.Rows [i]. Cells [1]. Value.ToString () + "', uslovia_hraneniya = ' "+ dgvTTov.Rows [i]. Cells [2]. Value.ToString () +" 'Where id_type_tovara = "+ dgvTTov.Rows [i]. Cells [0]. Value.ToString ());
}
// Все, що додали (m_TTovCountStart
{(int i = m_TTovCountStart; i
{_db.WriteDataBase ("Insert Into type_tovara (opisanie, uslovia_hraneniya) Values ​​('" + dgvTTov.Rows [i]. Cells [1]. Value.ToString () + "' , '"+ dgvTTov.Rows [i]. Cells [2]. Value.ToString () +"') ");
}
}. Show ("Змінено!", "Редагування"); _Load (0, null);
} void btnExit_Click (object sender, EventArgs e)
{();
} void btnDel_Click_1 (object sender, EventArgs e)
{(dgvTTov.SelectedRows [0]. Index
{(MessageBox.Show ("Ви впевнені?", "Видалення", MessageBoxButtons.OKCancel) == DialogResult.OK)
{_db.WriteDataBase ("Delete From type_tovara Where type_tovara. [id_type_tovara] =" + dgvTTov.SelectedRows [0]. Cells [0]. Value.ToString ()); _db.WriteDataBase ("Delete From tovar Where tovar. [id_type_tovara] =" + dgvTTov.SelectedRows [0]. Cells [0]. Value.ToString ());
} _Load (0, null);
}
}
}
}
Запити
Select id_tovara_na_sklade From SkladFrom nakladnaya Where nakladnaya. [id_tovara_na_sklade] Distinct (Postavshik.name_postavshika) From Postavshik, Sklad Where Postavshik.id_postavshika = Sklad.id_postavshikaInto sklad (id_postavshika, id_tovara, kolichestvo) Values ​​('" + dgvAdmSkl.Rows [i]. Cells [1]. Value.ToString () + "','" + dgvAdmSkl.Rows [i]. Cells [2]. Value.ToString () + "',' "+ dgvAdmSkl.Rows [i]. Cells [3]. Value.ToString () +" ') "),
"Select Tovar.name_tovara From Tovar Where" +
"id_tovara in (Select id_tovara From Sklad Where id_tovara_na_sklade =" + cmbIdTovNaSkl.Text + ")");
"Select kolichestvo From Sklad Where id_tovara_na...