Пример #1
0
 public static void nuevoCliente(ENTCliente cli)
 {
     ObjConnection.Open();
     string sql = "insert into cliente values (null,'" +
                 cli.nombre + "','" +
                 cli.direccion + "','" +
                 cli.telefono + "'" +
                 ");";
     SQLiteCommand command = new SQLiteCommand(sql, ObjConnection);
     command.ExecuteNonQuery();
     ObjConnection.Close();
 }
Пример #2
0
        public static ENTCliente buscarIdCliente(Int32 id)
        {
            ENTCliente equi = null;
            ObjConnection.Open();
            SQLiteCommand ObjCommand = new SQLiteCommand("SELECT * FROM cliente where id=" + id + "", ObjConnection);
            ObjCommand.CommandType = CommandType.Text;
            SQLiteDataAdapter ObjDataAdapter = new SQLiteDataAdapter(ObjCommand);
            DataTable dt = new DataTable("cliente");
            ObjDataAdapter.Fill(dt);
            ObjConnection.Close();

            foreach (DataRow dr in dt.Rows)
            {
                equi = new ENTCliente
                    (
                    Convert.ToInt32(dr["id"].ToString()),
                    dr["nombre"].ToString(),
                    dr["direccion"].ToString(),
                    dr["telefono"].ToString()
                    );
            }

            return equi;
        }