dataGridView1->DataSource = NaborDannix;
dataGridView1->DataMember = "talaba";
Ulanish->Close(); }
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {// MB ni yangilash
Komanda->CommandText = "UPDATE [talaba] SET [Fam] = ?, Ism = ?, Sharf = ?, "+ "Tug_sana = ?, Telefoni = ? WHERE ([id] = ?)";
// Ustun nomlari, tiplari, o‘lchami, ustun nomlari
Komanda->Parameters->Add("Fam", OleDb::OleDbType::VarWChar, 50, "Fam");
Komanda->Parameters->Add( "Ism", OleDb::OleDbType::VarWChar, 50, "Ism");
Komanda->Parameters->Add( "Sharf", OleDb::OleDbType::VarWChar, 50, "Sharf");
Komanda->Parameters->Add( "Tug_sana", OleDb::OleDbType::Date , 50, "Tug_sana");
Komanda->Parameters->Add( "Telefoni", OleDb::OleDbType::VarChar
, 50, "Telefoni"); Komanda->Parameters->Add(gcnew
OleDb::OleDbParameter("Original_id",
OleDb::OleDbType::Integer, 0, System::Data::ParameterDirection::
Input, false, (Byte)0, (Byte)0, "id", System::Data::DataRowVersion::
Original, nullptr));
Adaptеr->UpdateCommand = Komanda; Komanda->Connection = Ulanish;
try { // Update o‘zgargan qatorlar sonini qaytaradi:
int kol = Adaptеr->Update(NaborDanno`x, "talaba");
MessageBox::Show("Obnovlеno " + kol + " zapisеy"); }
catch (Exception ^ Situasiya)
{ MessageBox::Show(Situasiya->Message, "Nеdorazumеniе"); }
39. }
Dasturning tashqi ko‘rinishi quyidagicha:
Do'stlaringiz bilan baham: |