Aucune validation n a été faite sur l exemple.



Similar documents
PROCEDURE INSERTION(NUM IN EMPLOYES.NUMEMP%TYPE, NOM VARCHAR2, PRENOM IN VARCHAR2, PPHOTO IN BLOB, SALAIRE IN NUMBER);

Conexión SQL Server C#

I A Form és a párbeszédablakok I.1. MessageBox osztály MessageBox.Show(szöveg[,cím[,gombok[,ikon[,defaultbutton]]]]);

How To Create A Database In Araba

TP JSP : déployer chaque TP sous forme d'archive war

A Step by Step Guide for Building an Ozeki VoIP SIP Softphone

TP1 : Correction. Rappels : Stream, Thread et Socket TCP

如 何 在 C#.2005 中 使 用 ICPDAS I/O Card 的 DLL 檔 案

TP : Système de messagerie - Fichiers properties - PrepareStatement

POB-JAVA Documentation

How To Design An Eprescription System

Modifier le texte d'un élément d'un feuillet, en le spécifiant par son numéro d'index:

Cours de Java. Sciences-U Lyon. Java - Introduction Java - Fondamentaux Java Avancé.

ADOBE READER AND ACROBAT

Thursday, February 7, DOM via PHP

Les Support Packs IA94 et IA9H

Memo bconsole. Memo bconsole

Brazil + JDBC Juin 2001, douin@cnam.fr

Introduction au BIM. ESEB Seyssinet-Pariset Economie de la construction contact@eseb.fr

Tutorial 1: M/M/n Service System Simulation Tutorial 2: M/M/n Simulation using Excel input file Tutorial 3: A Production/Inventory System Simulation

Personnalisez votre intérieur avec les revêtements imprimés ALYOS design

Proxy IMAP/POP/SMTP securisé avec Perdition, Postfix et SASL

How To Develop A Mobile Application On Sybase Unwired Platform

Audit de sécurité avec Backtrack 5

Les Broadcast Receivers...

Mobile Application Development Using.NET

Introduction Les failles les plus courantes Les injections SQL. Failles Web. Maxime Arthaud. net7. Jeudi 03 avril 2014.

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";! SET time_zone = "+00:00";!

Liste d'adresses URL

RAPPORT FINANCIER ANNUEL PORTANT SUR LES COMPTES 2014

Chapter 14 WCF Client WPF Implementation. Screen Layout

Programmation RMI Sécurisée

Les fragments. Programmation Mobile Android Master CCI. Une application avec deux fragments. Premier layout : le formulaire

BACKING UP A DATABASE

ExempleRMI.java. // Fichier de defintion des droits et proprietes // System.setProperty("java.security.policy","../server.java.

Note concernant votre accord de souscription au service «Trusted Certificate Service» (TCS)

Sun Management Center Change Manager Release Notes

TP N 10 : Gestion des fichiers Langage JAVA

Tutorial: Windows Mobile Application Development. Sybase Unwired Platform 2.1 ESD #2

Remote Method Invocation

Licence Informatique Année Exceptions

How-to configure Auditing for IDENTIKEY Authentication Server 3.2 to a remote Oracle Database on a standalone Microsoft machine.

"Internationalization vs. Localization: The Translation of Videogame Advertising"

We are pleased to present you with detailed instructions on processing your visa application with us. Within this information pack you will find:

1. La classe Connexion class Connexion {

Tool & Asset Manager 2.0. User's guide 2015


N1 Grid Service Provisioning System 5.0 User s Guide for the Linux Plug-In

Technical Service Bulletin

Secure Routing and Identifying Hacking In P2p System

Calcul parallèle avec R

Solaris 10 Documentation README

Introduction to Visual Studio and C#

PostGIS Integration Tips

LS6300 Lecteur de code-barres laser

Web Services API Developer Guide

STUDENT APPLICATION FORM (Dossier d Inscription) ACADEMIC YEAR (Année Scolaire )

VIREMENTS BANCAIRES INTERNATIONAUX

Sun StorEdge A5000 Installation Guide

Il est repris ci-dessous sans aucune complétude - quelques éléments de cet article, dont il est fait des citations (texte entre guillemets).

Annexe - OAuth Introduction. Xavier de Rochefort xderoche@labri.fr - labri.fr/~xderoche 15 mai 2014

Documentation technique

Sun Enterprise Optional Power Sequencer Installation Guide

Using ilove SharePoint Web Services Workflow Action

Administrer les solutions Citrix XenApp et XenDesktop 7.6 CXD-203

Langages Orientés Objet Java

:: WIRELESS MOBILE MOUSE

"Templating as a Strategy for Translating Official Documents from Spanish to English"

TP : Configuration de routeurs CISCO

A Lean journey. Presented at the APEX symposium May 27, Jennifer Little Transport Canada. France Bergeron Alpen Path Solutions Inc.

Capturx for SharePoint 2.0: Notification Workflows

Read this document before using this product.

Sun StorEdge N8400 Filer Release Notes

14:00: [ ] <2> vnet_pbxconnect: pbxconnectex Succeeded 14:00: [ ] <2> logconnections: BPRD CONNECT FROM

Sun StorEdge RAID Manager Release Notes

Sun Cluster 2.2 7/00 Data Services Update: Apache Web Server

ANIMATION OF CONTINUOUS COMPUTER SIMULATIONS C.M. Woodside and Richard Mallet Computer Center, Carleton University ABSTRACT

Machine de Soufflage defibre

EPREUVE D EXPRESSION ORALE. SAVOIR et SAVOIR-FAIRE

Post-Secondary Opportunities For Student-Athletes / Opportunités post-secondaire pour les étudiantathlètes

ESMA REGISTERS OJ/26/06/2012-PROC/2012/004. Questions/ Answers

"Simultaneous Consecutive Interpreting: A New Technique Put to the Test"

AdaDoc. How to write a module for AdaDoc. August 28, 2002

Power Distribution System. Additional Information on page 2 See Page 2 Page 6. Eaton. See Page 2. Additional Information on page 2

16-Port Gigabit Green Switch (TEG-S16Dg) 24-Port Gigabit Green Switch (TEG-S24Dg)

Database Communica/on in Visual Studio/C# using Web Services. Hans- Pe=er Halvorsen, M.Sc.

Creating Form Rendering ASP.NET Applications

Immobiline DryStrip Reswelling Tray

ENERGY SERVICES& ESCOS & THE ROLE OFBELESCO LIEVEN VANSTRAELEN IN BELGIUM

Introduction ToIP/Asterisk Quelques applications Trixbox/FOP Autres distributions Conclusion. Asterisk et la ToIP. Projet tuteuré

REQUEST FORM FORMULAIRE DE REQUÊTE

Sun StorEdge Availability Suite Software Point-in-Time Copy Software Maximizing Backup Performance

STAGE INTERNATIONAL DE KENDO KENDO INTERNATIONAL SEMINAR

Rapid Recovery Techniques: Auditing Custom Software Configuration

Another way to look at the Project Une autre manière de regarder le projet. Montpellier 23 juin - 4 juillet 2008 Gourlot J.-P.

Transcription:

Cet exemple illustre l utilisation du Type BLOB dans la BD. Aucune validation n a été faite sur l exemple. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; using System.IO;

namespace Employes public partial class Form1 : Form public Form1() InitializeComponent(); private OracleConnection conn = new OracleConnection(); private DataSet mondataset = new DataSet(); string nomfichier; //byte monbuffimage; //string monimage; private void Form1_Load(object sender, EventArgs e) //205.237.246.251 //172.17.200.251 // string mabase = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.200.251)" // + "(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = orcl)))"; string mabase = "primogene"; string ChaineConnexion = "Data Source =" + mabase + ";User ID = user1 ;Password = oracle1"; conn.connectionstring = ChaineConnexion; conn.open(); MessageBox.Show(conn.State.ToString()); private void Quitter_Click(object sender, EventArgs e) conn.close(); Application.Exit(); // Lire l'image à partir d,un fichier avec le bouton Chercher Image private void ChercherImage_Click(object sender, EventArgs e) string nomfichier; nomfichier = RechercherFichier(); if (nomfichier!= null) Photoemp.Image = System.Drawing.Image.FromFile(nomFichier); Photoemp.ImageLocation = nomfichier;

// chercher le fichier image private string RechercherFichier() OpenFileDialog fimage = new OpenFileDialog(); fimage.title = "selectionner une image"; fimage.checkfileexists = true; fimage.initialdirectory = @":C\"; //fimage.initialdirectory = Application.StartupPath; fimage.filter= "Fichiers images (*.BMP;*.JPG;*.GIF) *.BMP;*.JPG;*.GIF All files (*.*) *.*"; fimage.filterindex = 1; fimage.restoredirectory = true; if (fimage.showdialog() == DialogResult.OK) nomfichier = fimage.filename; Bitmap bitmap1 = new Bitmap(nomFichier); else nomfichier = null; return nomfichier; // ajouter un enregistrement contenat la photo private void Ajouter_Click(object sender, EventArgs e) OracleCommand orains = new OracleCommand("insert into employes (numemp, nom, prenom,photo)values(:numemp,:nom,:prenom,:photo)", conn); OracleParameter Pnumemp = new OracleParameter(":numemp", OracleDbType.Int32); OracleParameter pnom = new OracleParameter (":nom", OracleDbType.NVarchar2,30); OracleParameter pprenom = new OracleParameter(":prenom", OracleDbType.NVarchar2, 30); OracleParameter pphoto = new OracleParameter(":photo", OracleDbType.Blob); Pnumemp.Value = Nemp.Text; pnom.value = Nomemp.Text; pprenom.value = Prnemp.Text; orains.parameters.add(pnumemp); orains.parameters.add(pnom);

orains.parameters.add(pprenom); // récuper le fichier nomfichier et le convertir en Byte. //le résultat est dans buffer1 // oracle stocke les images sous forme de Bytes. FileStream Streamp = new FileStream(nomFichier, FileMode.Open, FileAccess.Read); byte [] buffer1 =new byte[streamp.length]; Streamp.Read(buffer1,0,System.Convert.ToInt32(Streamp.Length)); Streamp.Close(); // ajout de la photo dans la BD. pphoto.value = buffer1; orains.parameters.add(pphoto); orains.executenonquery(); vider(); private void Afficher_Click(object sender, EventArgs e) string sql = "select * from employes"; OracleDataAdapter monadapter = new OracleDataAdapter(sql, conn); monadapter.fill(mondataset, "ListeEmployes"); lister(); private void lister() Nemp.DataBindings.Add("Text", mondataset, "ListeEmployes.numemp"); Nomemp.DataBindings.Add("Text", mondataset, "ListeEmployes.Nom"); Prnemp.DataBindings.Add("Text", mondataset, "ListeEmployes.Prenom"); // pour afficher l'image, le type est Image et ça prend le paramètre TRUE Photoemp.DataBindings.Add("Image", mondataset,"listeemployes.photo", true); private void suivant_click(object sender, EventArgs e) this.bindingcontext[mondataset, "ListeEmployes"].Position += 1; private void precedent_click(object sender, EventArgs e) this.bindingcontext[mondataset, "ListeEmployes"].Position -= 1;

private void premier_click(object sender, EventArgs e) this.bindingcontext[mondataset, "ListeEmployes"].Position = 0; private void dernier_click(object sender, EventArgs e) this.bindingcontext[mondataset, "ListeEmployes"].Position = this.bindingcontext[mondataset, "ListeEmployes"].Count - 1; private void vider() Nemp.DataBindings.Clear(); Nomemp.DataBindings.Clear(); Prnemp.DataBindings.Clear(); Photoemp.DataBindings.Clear(); Nemp.Clear(); Nomemp.Clear(); Nomemp.Clear(); Prnemp.Clear(); Photoemp.Image = null; // Utiliser OraclePrarameters pour les modifications dans la BD private void Modifier_Click(object sender, EventArgs e) string sqlmodiy = "update employes set nom=:nom, prenom =:prenom, photo=:photo where numemp=:numemp"; OracleCommand OraUpdate = new OracleCommand(sqlModiy, conn); OracleParameter pnom = new OracleParameter(":nom", OracleDbType.NVarchar2, 30); OracleParameter pprenom = new OracleParameter(":prenom", OracleDbType.NVarchar2, 30); OracleParameter pphoto = new OracleParameter(":photo", OracleDbType.Blob); OracleParameter Pnumemp = new OracleParameter(":numemp", OracleDbType.Int32); pnom.value = Nomemp.Text; pprenom.value = Prnemp.Text; Pnumemp.Value = Nemp.Text; // Charger la photo dans le Buffer FileStream Streamp = new FileStream(nomFichier, FileMode.Open, FileAccess.Read); byte[] buffer1 = new byte[streamp.length]; Streamp.Read(buffer1, 0, System.Convert.ToInt32(Streamp.Length)); Streamp.Close(); // Modification de la Photo pphoto.value = buffer1; OraUpdate.Parameters.Add(pprenom);

OraUpdate.Parameters.Add(pnom); OraUpdate.Parameters.Add(pphoto); OraUpdate.Parameters.Add(Pnumemp); OraUpdate.ExecuteNonQuery();