我在我的Resources文件夹中包含一个图标图像,并通过
检索它public function venderProduto($id, $id_cliente, $medicamento, $quantidade, $preco)
{
$data = array('id_venda' => null,
'id_cliente' => $id_cliente,
'medicamento' => $medicamento,
'quantidade' => $quantidade,
'preco' => $preco);
$this->db->insert('vendas', $data);
//test to make sure that insert was successful
if ($this->db->insert_id())
{
//get existing stock quantity
$this->db->select('stock-quantidade');
$this->db->where('id_venda', $id);
$query = $this->db->get('produtos');
$row = $query->row();
$quantity_in_stock = $row->stock-quantidade;
//I am assuming that $quantidade is the quantity of the order
$new_quantity_in_stock = $quantity_in_stock - $quantidade;
//update products table
$this->db->where('id_venda', $id);
$this->db->update('produtos', array('stock-quantidade' => $new_quantity_in_stock ));
}
}
然而,在检索图标后,我想将图标存储到硬盘中的路径。知道怎么做吗?
答案 0 :(得分:2)
您可以使用图标的Save()
方法和FileStream
:
icon1.Save(new FileStream("c:\\myicon.ico", FileMode.Create));