예제 #1
0
        public void update(ClienteProductoModel cliProdModel)
        {
            SqlConnection sqlcon = new SqlConnection();

            try
            {
                BaseDato       con      = new BaseDato();
                OdbcConnection conexion = con.ConnectPostgres();

                OdbcCommand select = new OdbcCommand();
                select.Connection  = conexion;
                select.CommandText = "UPDATE clienteproducto SET "
                                     + "\"precioNeto\"=" + cliProdModel.precioNeto + ","
                                     + "\"precioVenta\"=" + cliProdModel.precioVenta + " "
                                     + "WHERE \"rutCliente\" = '" + cliProdModel.rutCliente + "'"
                                     + "and \"idProducto\" = " + cliProdModel.idProducto + ";";
                OdbcDataReader reader = select.ExecuteReader();
            }
            catch (Exception ex)
            {
                throw new Exception("Error" + ex.Message);
            }

            finally
            {
                sqlcon.Close();
            }
        }
예제 #2
0
        public void save(ClienteProductoModel cliProdModel)
        {
            try
            {
                BaseDato       con      = new BaseDato();
                OdbcConnection conexion = con.ConnectPostgres();

                OdbcCommand select = new OdbcCommand();
                select.Connection  = conexion;
                select.CommandText =
                    "INSERT INTO clienteproducto("
                    + "\"idProducto\", \"rutCliente\", \"precioNeto\", \"precioVenta\")"
                    + " VALUES ("
                    + cliProdModel.idProducto + ",'"
                    + cliProdModel.rutCliente + "',"
                    + cliProdModel.precioNeto + ","
                    + cliProdModel.precioVenta + ");";

                OdbcDataReader reader = select.ExecuteReader();
            }
            catch (Exception ex)
            {
                throw new Exception("Error" + ex.Message);
            }
        }