public List <clsRegion> verRegistro() { SQLiteConnector.CreateTable(); List <clsRegion> Regiones = new List <clsRegion>(); SQLiteConnection conn = SQLiteConnector.CreateConnection(); SQLiteCommand command; SQLiteDataReader reader; command = conn.CreateCommand(); command.CommandText = "SELECT * FROM Region"; try { reader = command.ExecuteReader(); while (reader.Read()) { Regiones.Add(new clsRegion( reader.GetInt32(0), reader.GetString(1), reader.GetString(2) )); } } catch (SQLiteException e) { System.Windows.Forms.MessageBox.Show(e.ToString()); } conn.Close(); return(Regiones); }
public DataSet dataSet() { DataSet ds = new DataSet(); SQLiteDataAdapter da = new SQLiteDataAdapter("SELECT * FROM Region", SQLiteConnector.CreateConnection()); da.Fill(ds); return(ds); }
public void eliminar(clsRegion region) { SQLiteConnection conn = SQLiteConnector.CreateConnection(); SQLiteCommand sqliteCommand; sqliteCommand = conn.CreateCommand(); sqliteCommand.CommandText = "DELETE FROM Region WHERE paisId = " + region.codigo + ";"; sqliteCommand.ExecuteNonQuery(); conn.Close(); }
public void eliminar(clsEmpleado empleado) { SQLiteConnection conn = SQLiteConnector.CreateConnection(); SQLiteCommand sqliteCommand; sqliteCommand = conn.CreateCommand(); sqliteCommand.CommandText = "DELETE FROM Empleado WHERE empleadoID = " + empleado.id + ";"; sqliteCommand.ExecuteNonQuery(); conn.Close(); }
public void eliminar(clsDepartamento depart) { SQLiteConnection conn = SQLiteConnector.CreateConnection(); SQLiteCommand sqliteCommand; sqliteCommand = conn.CreateCommand(); sqliteCommand.CommandText = "DELETE FROM Departmento WHERE departamentID = " + depart.codigo + ";"; sqliteCommand.ExecuteNonQuery(); conn.Close(); }
public void modificar(clsRegion region) { SQLiteConnection conn = SQLiteConnector.CreateConnection(); SQLiteCommand sqliteCommand; sqliteCommand = conn.CreateCommand(); sqliteCommand.CommandText = @"UPDATE Region SET " + "paisId = " + region.codigo + "," + "continente = '" + region.continente + "'," + "pais = '" + region.pais + "';"; sqliteCommand.ExecuteNonQuery(); conn.Close(); }
public void agregar(clsRegion region) { SQLiteConnection conn = SQLiteConnector.CreateConnection(); SQLiteCommand sqliteCommand; sqliteCommand = conn.CreateCommand(); sqliteCommand.CommandText = @"INSERT INTO Region(paisId, continente, pais) VALUES (" + "" + region.codigo + ", " + "'" + region.continente + "', " + "'" + region.pais + "');"; sqliteCommand.ExecuteNonQuery(); conn.Close(); }
public void modificar(clsDepartamento depart) { SQLiteConnection conn = SQLiteConnector.CreateConnection(); SQLiteCommand sqliteCommand; sqliteCommand = conn.CreateCommand(); sqliteCommand.CommandText = @"UPDATE Departamento SET " + "departmentID = " + depart.codigo + "," + "nombre = '" + depart.nombre + "'," + "paisId = " + depart.paisId + "," + "noContact = '" + depart.noContact + ";"; sqliteCommand.ExecuteNonQuery(); conn.Close(); }
public void agregar(clsDepartamento depart) { SQLiteConnection conn = SQLiteConnector.CreateConnection(); SQLiteCommand sqliteCommand; sqliteCommand = conn.CreateCommand(); sqliteCommand.CommandText = @"INSERT INTO Departamento(departmentID, nombre, paisId, noContact) VALUES (" + "" + depart.codigo + ", " + "'" + depart.nombre + "', " + "" + depart.paisId + ", " + "" + depart.noContact + ");"; sqliteCommand.ExecuteNonQuery(); conn.Close(); }
public void modificar(clsEmpleado empleado) { SQLiteConnection conn = SQLiteConnector.CreateConnection(); SQLiteCommand sqliteCommand; sqliteCommand = conn.CreateCommand(); sqliteCommand.CommandText = @"UPDATE Empleado SET " + "empleadoID = " + empleado.id + "," + "nombre = '" + empleado.nombre + "'," + "apellido = '" + empleado.apellido + "'," + "departamentID = " + empleado.departId + "," + "cargo = '" + empleado.cargo + "';"; sqliteCommand.ExecuteNonQuery(); conn.Close(); }
public void agregar(clsEmpleado empleado) { SQLiteConnection conn = SQLiteConnector.CreateConnection(); SQLiteCommand sqliteCommand; sqliteCommand = conn.CreateCommand(); sqliteCommand.CommandText = @"INSERT INTO Empleado(empleadoID, nombre, apellido, departamentID, cargo) VALUES (" + "" + empleado.id + ", " + "'" + empleado.nombre + "', " + "'" + empleado.apellido + "', " + "" + empleado.departId + ", " + "'" + empleado.cargo + "');"; sqliteCommand.ExecuteNonQuery(); conn.Close(); }
public static void CreateTable() { SQLiteCommand sqliteCommand; string createSQL = @" CREATE TABLE 'Region' ( 'paisID' INTEGER, 'pais' TEXT, 'continente' TEXT, PRIMARY KEY('paisID' AUTOINCREMENT) ); CREATE TABLE 'Departamento' ( 'departamentID' INTEGER, 'nombre' TEXT, 'paisID' INTEGER, 'noContact' INTEGER, PRIMARY KEY('departamentID' AUTOINCREMENT), FOREIGN KEY('paisID') REFERENCES Region(paisID) ); CREATE TABLE 'Empleado' ( 'empleadoID' INTEGER, 'nombre' TEXT, 'apellido' TEXT, 'departamentID' INTEGER, 'cargo' TEXT, PRIMARY KEY('empleadoID' AUTOINCREMENT), FOREIGN KEY('departamentID') REFERENCES Departamento(departamentID) );"; sqliteCommand = SQLiteConnector.CreateConnection().CreateCommand(); sqliteCommand.CommandText = createSQL; try { sqliteCommand.ExecuteNonQuery(); } catch { } }