IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langages Discussion :

Imprimer un ID depuis une table SQL


Sujet :

Langages

  1. #1
    Membre éclairé
    Inscrit en
    Octobre 2006
    Messages
    316
    Détails du profil
    Informations forums :
    Inscription : Octobre 2006
    Messages : 316
    Par défaut Imprimer un ID depuis une table SQL
    Bonjour à tous,

    Je suis face à un problème que je ne vois pas comment le résoudre.
    Mon objectif étant d'imprimer un n° ID provenant d'une table SQL, sur une feuille.

    Extrait de ma table SQL:
    L'ID à imprimer est IDBOITE

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    [QTE SORTIE]  [MPN]  [IDBOITE] 
    204 Kg	     0007	1781-135356
    204 Kg	     0008	1781-135356
    444 Kg	     9430	1781-13541
    444 Kg	     9436	1781-13541
    444 Kg	     0009	1781-13541
    444 Kg	     0010	1781-13541
    Mon code permet d'imprimer 2 pages avec certaines informations puisque ma table contient 2 [IDBOITE] différents. Jusque là, pas de problème.
    Maintenant sur le document, je dois faire apparaitre sur la premiere feuille, le premier IDBOITE (1781-135356), puis sur la seconde feuille, le second IDBOITE (1781-13541), etc.. (autant qu'il y a d'IDBOITE différent).

    J'utilise PrintDocument1 pour générer ma ou mes pages à imprimer (voir ci-dessous). Certaines données proviennent d'un Datagridview (DG_Planning).
    Vous constaterez aussi que sur une même page, j'imprime 2 fois la même étiquette! Donc je dois avoir 2 fois le même IDBOITE sur chaque page.

    Une idée pour m'aiguiller ?
    Merci à tous !!

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
     
    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
     
            'Insertion LOGO
            Try
                Dim r, r2 As Rectangle
                r = New Rectangle(20, 20, 144, 44)
                e.Graphics.DrawImage(PictureBox1.Image, r)
                r2 = New Rectangle(20, 590, 144, 44)
                e.Graphics.DrawImage(PictureBox1.Image, r2)
                'print page
                e.HasMorePages = False
     
            Catch ex As Exception
     
            End Try
     
     
     
            Dim i As Integer
            Dim mUP As [String] = ""
            Dim mCM As [String] = ""
            Dim mDIA As [String] = ""
            Dim mAlliage As [String] = ""
            Dim mQSor As [String] = ""
            Dim mCCh As [String] = ""
            Dim mNbrC As [String] = ""
            Dim mMicro As [String] = ""
     
            Try
                i = DG_Planning.CurrentRow.Index
     
                ' Chargement des String à dessiner.
                mUP = DG_Planning.Item(0, i).Value
                mCM = tb_NumCou.Text
                mDIA = L_DIA2.Text
                mAlliage = DG_Planning.Item(2, i).Value
                ' mQSor = DG_Planning.Item(8, i).Value & " x " & DG_Planning.Item(7, i).Value
                mCCh = DG_Planning.Item(3, i).Value
                mNbrC = L_NBC2.Text
                mMicro = L_MIC2.Text
     
     
            Catch ex As Exception
     
            End Try
     
            ' Creation des font & brush.
            Dim drawFont As New Font("Verdana", 10)
            Dim drawBrush As New SolidBrush(Color.Black)
     
            ''Imprimer les Labels et codes à Barre 39
            'UP
            e.Graphics.DrawString(L_UP.Text, L_UP.Font, Brushes.Black, 100, 130)
            e.Graphics.DrawString(L_UP39.Text, L_UP39.Font, Brushes.Black, 250, 130)
            e.Graphics.DrawString(mUP, drawFont, drawBrush, 250, 152)
            'ID BOITE
            e.Graphics.DrawString(L_IDBoite2.Text, L_IDBoite2.Font, Brushes.Black, 657, 110)
            e.Graphics.DrawString(L_IdBoite.Text, L_IdBoite.Font, Brushes.Black, 642, 130)
            'Coulee mére
            e.Graphics.DrawString(L_CM.Text, L_CM.Font, Brushes.Black, 100, 180)
            e.Graphics.DrawString(L_CM39.Text, L_CM39.Font, Brushes.Black, 250, 180)
            e.Graphics.DrawString(mCM, drawFont, drawBrush, 250, 202)
            'Diametre
            e.Graphics.DrawString(L_DIA.Text, L_DIA.Font, Brushes.Black, 100, 230)
            e.Graphics.DrawString(L_DIA39.Text, L_DIA39.Font, Brushes.Black, 250, 230)
            e.Graphics.DrawString(mDIA, drawFont, drawBrush, 250, 252)
            'Alliage
            e.Graphics.DrawString(L_Alliage.Text, L_Alliage.Font, Brushes.Black, 100, 280)
            e.Graphics.DrawString(L_Alliage39.Text, L_Alliage39.Font, Brushes.Black, 250, 280)
            e.Graphics.DrawString(mAlliage, drawFont, drawBrush, 250, 302)
            'Qte Sortie
            e.Graphics.DrawString(L_QSor.Text, L_QSor.Font, Brushes.Black, 100, 330)
            e.Graphics.DrawString(L_QSor39.Text, L_QSor39.Font, Brushes.Black, 250, 330)
            ' e.Graphics.DrawString(mQSor, drawFont, drawBrush, 250, 352)
            'CCH
            e.Graphics.DrawString(L_CCH.Text, L_CCH.Font, Brushes.Black, 100, 380)
            e.Graphics.DrawString(L_CCH39.Text, L_CCH39.Font, Brushes.Black, 250, 380)
            e.Graphics.DrawString(mCCh, drawFont, drawBrush, 250, 402)
            'Nbr CHarge
            e.Graphics.DrawString(L_NCharg.Text, L_NCharg.Font, Brushes.Black, 100, 430)
            e.Graphics.DrawString(L_NCharg39.Text, L_NCharg39.Font, Brushes.Black, 250, 430)
            e.Graphics.DrawString(mNbrC, drawFont, drawBrush, 250, 452)
            'MICRO
            e.Graphics.DrawString(L_Micro.Text, L_Micro.Font, Brushes.Black, 100, 480)
            e.Graphics.DrawString(L_Micro39.Text, L_Micro39.Font, Brushes.Black, 250, 480)
            e.Graphics.DrawString(mMicro, drawFont, drawBrush, 250, 502)
     
            'Ligne de découpe
            e.Graphics.DrawString("----------------------------------------------------------------------------------", L_Micro.Font, Brushes.Black, 20, 550)
     
            '************************
            'SECONDE PARTIE ETIQUETTE
            '************************
            'UP
            e.Graphics.DrawString(L_UP.Text, L_UP.Font, Brushes.Black, 100, 700)
            e.Graphics.DrawString(L_UP39.Text, L_UP39.Font, Brushes.Black, 250, 700)
            e.Graphics.DrawString(mUP, drawFont, drawBrush, 250, 722)
            'ID BOITE
            e.Graphics.DrawString(L_IDBoite2.Text, L_IDBoite2.Font, Brushes.Black, 657, 680)
            e.Graphics.DrawString(L_IdBoite.Text, L_IdBoite.Font, Brushes.Black, 642, 700)
            'COULEE MERE
            e.Graphics.DrawString(L_CM.Text, L_CM.Font, Brushes.Black, 100, 750)
            e.Graphics.DrawString(L_CM39.Text, L_CM39.Font, Brushes.Black, 250, 750)
            e.Graphics.DrawString(mCM, drawFont, drawBrush, 250, 772)
            'DIAMETRE
            e.Graphics.DrawString(L_DIA.Text, L_DIA.Font, Brushes.Black, 100, 800)
            e.Graphics.DrawString(L_DIA39.Text, L_DIA39.Font, Brushes.Black, 250, 800)
            e.Graphics.DrawString(mDIA, drawFont, drawBrush, 250, 822)
            'ALLIAGE
            e.Graphics.DrawString(L_Alliage.Text, L_Alliage.Font, Brushes.Black, 100, 850)
            e.Graphics.DrawString(L_Alliage39.Text, L_Alliage39.Font, Brushes.Black, 250, 850)
            e.Graphics.DrawString(mAlliage, drawFont, drawBrush, 250, 872)
            'QTE SORTIE
            e.Graphics.DrawString(L_QSor.Text, L_QSor.Font, Brushes.Black, 100, 900)
            e.Graphics.DrawString(L_QSor39.Text, L_QSor39.Font, Brushes.Black, 250, 900)
            'e.Graphics.DrawString(mQSor, drawFont, drawBrush, 250, 922)
            'CCH
            e.Graphics.DrawString(L_CCH.Text, L_CCH.Font, Brushes.Black, 100, 950)
            e.Graphics.DrawString(L_CCH39.Text, L_CCH39.Font, Brushes.Black, 250, 950)
            e.Graphics.DrawString(mCCh, drawFont, drawBrush, 250, 972)
            'NBRE CHARGE
            e.Graphics.DrawString(L_NCharg.Text, L_NCharg.Font, Brushes.Black, 100, 1000)
            e.Graphics.DrawString(L_NCharg39.Text, L_NCharg39.Font, Brushes.Black, 250, 1000)
            e.Graphics.DrawString(mNbrC, drawFont, drawBrush, 250, 1022)
            'MICRO
            e.Graphics.DrawString(L_Micro.Text, L_Micro.Font, Brushes.Black, 100, 1050)
            e.Graphics.DrawString(L_Micro39.Text, L_Micro39.Font, Brushes.Black, 250, 1050)
            e.Graphics.DrawString(mMicro, drawFont, drawBrush, 250, 1072)
     
     
        End Sub

  2. #2
    Membre éclairé
    Inscrit en
    Octobre 2006
    Messages
    316
    Détails du profil
    Informations forums :
    Inscription : Octobre 2006
    Messages : 316
    Par défaut
    Bonjour,

    Comme tout le monde séche y compris moi (à moins que l'énoncé soit incompréhensible (?)), j'ai contourné le problème et donc du coup plus besoin de ceci.
    Merci à ceux qui ont pris le temps de me lire.

Discussions similaires

  1. [Débutant] coché les radiobuttons depuis une table sql
    Par Sjida dans le forum ASP.NET
    Réponses: 1
    Dernier message: 13/07/2014, 15h10
  2. Remplir table sql server depuis une table excel
    Par silifana dans le forum MS SQL Server
    Réponses: 5
    Dernier message: 14/02/2009, 15h23
  3. Réponses: 9
    Dernier message: 17/07/2008, 09h14
  4. Mise à jour d'une une table sql depuis table importée
    Par Yohann_x dans le forum Requêtes et SQL.
    Réponses: 1
    Dernier message: 09/03/2006, 11h43
  5. [C#] Récupération d'une image depuis une table SQL Server
    Par borgfabr dans le forum Accès aux données
    Réponses: 10
    Dernier message: 08/04/2004, 13h20

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo