viernes, 6 de febrero de 2015

MODIFICAR DATOS

private:System::Void MODIFICAR()
{
//APUNTADORES PARA LA  BASE DE DATOS
System::Data::OleDb::OleDbConnection^ Cnn;
System::Data::OleDb::OleDbCommand^ Micomando;
System::Data::OleDb::OleDbDataReader^ Datos;
System::String^ strconexion;
System::String^ strsql;
//CONEXION PARA LA BASE DE DATOS
strconexion="Provider=Microsoft.Jet.OLEDB.4.0; Data Source= 'ACCESS2003.mdb' ";
                 Cnn = gcnew  OleDbConnection(strconexion);
Cnn->Open();
//SELECCION DE LA BASE DE DATOS
// this->textBox1->Text == L"Cancelado";
strsql=("UPDATE contacto SET ciudad= '"+ this->ciudad->Text+" '   WHERE TELEFONO=  '" + this->buscartelefono->Text + "' ; ");

                     Micomando= gcnew OleDbCommand(strsql,Cnn);
try {
Datos = Micomando->ExecuteReader();
// MessageBox::Show("Actualizando");
// this->groupBox1->Visible=false;
     
     }
catch (System::Exception^ z)
{
MessageBox::Show("Error Actualizando"+ z->Message  );
}
}

No hay comentarios:

Publicar un comentario