public static DataTable BuscarC(Class_ClienteTB C) { OleDbCommand comando = new OleDbCommand(string.Format("select * from Table_Cliente where Nombre LIKE '%{0}%'", C.Nombre1), cnn); try { cnn.Open(); OleDbDataAdapter da = new OleDbDataAdapter(comando); ds = new DataSet(); da.Fill(ds, "Table_Cliente"); cnn.Close(); } catch (Exception) { MessageBox.Show("Hay problemas..."); throw; } finally { cnn.Close(); } return(ds.Tables["Table_Cliente"]); }
public static void EliminarC(Class_ClienteTB C) { OleDbCommand comando = new OleDbCommand(string.Format("Delete from Table_Cliente where IdCliente='{0}'", C.IdCliente1), cnn); try { cnn.Open(); comando.ExecuteNonQuery(); MessageBox.Show("Se elimino exitosamente"); cnn.Close(); } catch (Exception) { MessageBox.Show("Hay problemas..."); throw; } finally { cnn.Close(); } }
public static void ActualisarC(Class_ClienteTB C) { OleDbCommand comando = new OleDbCommand(string.Format("Update Table_Cliente set Nombre='{0}', RFC='{1}', Direccion='{2}', Telefono='{3}', Email='{4}', Razonsocial='{5}' where IdCliente='{6}'", C.Nombre1, C.RFC1, C.Direccion1, C.Telefono1, C.Email1, C.Razonsocial1, C.IdCliente1), cnn); try { cnn.Open(); comando.ExecuteNonQuery(); MessageBox.Show("Se Modifico correctamente"); cnn.Close(); } catch (Exception) { MessageBox.Show("Hay problemas..."); throw; } finally { cnn.Close(); } }
public static void GuardarC(Class_ClienteTB C) { OleDbCommand comando = new OleDbCommand(string.Format("Insert into Table_Cliente (Nombre, RFC, Direccion, Telefono, Email, Razonsocial) values ('{0}','{1}','{2}','{3}','{4}','{5}')", C.Nombre1, C.RFC1, C.Direccion1, C.Telefono1, C.Email1, C.Razonsocial1), cnn); try { cnn.Open(); comando.ExecuteNonQuery(); MessageBox.Show("Se guardo exitosamente"); cnn.Close(); } catch (Exception) { MessageBox.Show("Hay problemas..."); throw; } finally { cnn.Close(); } }