Dasturiy injiniring nazariy savollarga javoblar
1-savol Ma’lumotlar ustid asosiy amallar CRUD da Delete(o’chirish) amali
Ko’pgina ma’lumotlar ustida CRUD (create,read, update va delete)
Ya’ni yaratish, o’qish, yangilash va o’chirish amallari. Entity framework orqali buni amalga oshirish oson.
try
{
if (dataGridView1.SelectedRows.Count > 0)
{
int index = dataGridView1.SelectedRows[0].Index;
int id = 0;
bool convert=Int32.TryParse(dataGridView1[0,index].Value.ToString(),out id);
if(convert==false)
return;
program p=db.program.Find(id);
db.program.Remove(p);
db.SaveChanges();
MessageBox.Show("ma'lumot o'chirildi");
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
Do'stlaringiz bilan baham: |