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

Bases de données Delphi Discussion :

excel vers Table Paradox


Sujet :

Bases de données Delphi

  1. #1
    Nouveau membre du Club
    Inscrit en
    Février 2006
    Messages
    66
    Détails du profil
    Informations forums :
    Inscription : Février 2006
    Messages : 66
    Points : 37
    Points
    37
    Par défaut excel vers Table Paradox
    Slt;
    voila qu'est ce que j'ai comme programme mais +ieurs mesg d'erreurs
    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
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    [FONT=Times New Roman]private[/FONT]
    [FONT=Times New Roman]    { Déclarations privées }[/FONT]
    [FONT=Times New Roman]    procedure SaveInBD(sNom, sPNom, sSexe, sLN, sAdr, sSF, sCat, sEAf, sEAct : string;[/FONT]
    [FONT=Times New Roman]                          sMat, sFct, sSB, sUAf, sDAf, sSAf, sNSS : integer ;[/FONT]
    [FONT=Times New Roman]                          sDNais, sDRec, sDDep: TdateTime);[/FONT]
    [FONT=Times New Roman].[/FONT]
    [FONT=Times New Roman].[/FONT]
    [FONT=Times New Roman].[/FONT]
    [FONT=Times New Roman].[/FONT]
    [FONT=Times New Roman]..[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman]procedure TForm1.Button1Click(Sender: TObject);[/FONT]
    [FONT=Times New Roman]var[/FONT]
    [FONT=Times New Roman]  XlsWk:_workbook;[/FONT]
    [FONT=Times New Roman]  XlsPage :_Worksheet;[/FONT]
    [FONT=Times New Roman]  sFile: string;[/FONT]
    [FONT=Times New Roman]  sNom, sPNom, sSexe, sLN, sAdr, sSF, sCat, sEAf, sEAct : string;[/FONT]
    [FONT=Times New Roman]  sMat, sFct, sSB, sUAf, sDAf, sSAf, sNSS : integer ;[/FONT]
    [FONT=Times New Roman]  sDNais, sDRec, sDDep: TdateTime;[/FONT]
    [FONT=Times New Roman]  bFin: boolean;[/FONT]
    [FONT=Times New Roman]  iLine: integer;[/FONT]
    [FONT=Times New Roman] begin[/FONT]
    [FONT=Times New Roman]  XlsApp.Connect;[/FONT]
    [FONT=Times New Roman]  XlsApp.Visible[0] := true;[/FONT]
    [FONT=Times New Roman]  sFile := ExtractFilePath(Application.ExeName) + 'BD FA';[/FONT]
    [FONT=Times New Roman]  XlsWk := XlsApp.Workbooks.Open(sFile, False, False, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, 0);[/FONT]
    [FONT=Times New Roman]  XlsPage := XlsWk.Worksheets['CopiedeDEB'] as _worksheet;[/FONT]
    [FONT=Times New Roman]  DMGE.TEmpl.Open;[/FONT]
    [FONT=Times New Roman]  bFin := false;[/FONT]
    [FONT=Times New Roman]  iLine := 1;[/FONT]
    [FONT=Times New Roman]  repeat[/FONT]
    [FONT=Times New Roman]    // lire les données[/FONT]
    [FONT=Times New Roman]    sMat := XlsPage.Cells.Item[iLine, 1].Value;[/FONT]
    [FONT=Times New Roman]    sNom := XlsPage.Cells.Item[iLine, 2].Value;[/FONT]
    [FONT=Times New Roman]    sPNom := XlsPage.Cells.Item[iLine, 3].Value;[/FONT]
    [FONT=Times New Roman]    sSexe := XlsPage.Cells.Item[iLine, 4].Value;[/FONT]
    [FONT=Times New Roman]    sDNais := XlsPage.Cells.Item[iLine, 5].Value;[/FONT]
    [FONT=Times New Roman]    sLN := XlsPage.Cells.Item[iLine, 6].Value;[/FONT]
    [FONT=Times New Roman]    sAdr := XlsPage.Cells.Item[iLine, 7].Value;[/FONT]
    [FONT=Times New Roman]    sSF := XlsPage.Cells.Item[iLine, 8].Value;[/FONT]
    [FONT=Times New Roman]    sDRec := XlsPage.Cells.Item[iLine, 9].Value;[/FONT]
    [FONT=Times New Roman]    sFct := XlsPage.Cells.Item[iLine, 10].Value;[/FONT]
    [FONT=Times New Roman]    sCat := XlsPage.Cells.Item[iLine, 11].Value;[/FONT]
    [FONT=Times New Roman]    sSB := XlsPage.Cells.Item[iLine, 12].Value;[/FONT]
    [FONT=Times New Roman]    sEAf := XlsPage.Cells.Item[iLine, 13].Value;[/FONT]
    [FONT=Times New Roman]    sUAf := XlsPage.Cells.Item[iLine, 14].Value;[/FONT]
    [FONT=Times New Roman]    sDAf := XlsPage.Cells.Item[iLine, 15].Value;[/FONT]
    [FONT=Times New Roman]    sSAf := XlsPage.Cells.Item[iLine, 16].Value;[/FONT]
    [FONT=Times New Roman]    sNSS := XlsPage.Cells.Item[iLine, 17].Value;[/FONT]
    [FONT=Times New Roman]    sDDep := XlsPage.Cells.Item[iLine, 18].Value;[/FONT]
    [FONT=Times New Roman]    sEAct := XlsPage.Cells.Item[iLine, 19].Value;[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman]    if sMat = 0 then[/FONT]
    [FONT=Times New Roman]      Break;  // fin des données XLS[/FONT]
    [FONT=Times New Roman]    // met à jour la table[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman]    SaveInBD(sMat,sNom, sPNom, sSexe, sDNais, sLN, sAdr, sSF, sDRec, sFct,sCat,sSB,sEAct, sUAf, sDAf, sSAf, sNSS, sDDep, sEAct);[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman]    Inc(iLine);  // ligne suivante dans XLS[/FONT]
    [FONT=Times New Roman]  Until bFin;[/FONT]
    [FONT=Times New Roman] end;[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman]procedure TForm1.SaveInBD(sNom, sPNom, sSexe, sLN, sAdr, sSF, sCat, sEAf, sEAct : string;[/FONT]
    [FONT=Times New Roman]                          sMat, sFct, sSB, sUAf, sDAf, sSAf, sNSS : integer ;[/FONT]
    [FONT=Times New Roman]                          sDNais, sDRec, sDDep: TdateTime);[/FONT]
    [FONT=Times New Roman] var[/FONT]
    [FONT=Times New Roman]  i: integer;[/FONT]
    [FONT=Times New Roman] begin[/FONT]
    [FONT=Times New Roman]  with DMGE.TEmpl do begin[/FONT]
    [FONT=Times New Roman]    SetKey;[/FONT]
    [FONT=Times New Roman]    FieldByName('Matricule'). asInteger := sMat;[/FONT]
    [FONT=Times New Roman]    FieldByName('Nom'). asString := sNom;[/FONT]
    [FONT=Times New Roman]    FieldByName('Prenom'). asString := sPNom;[/FONT]
    [FONT=Times New Roman]    FieldByName('Sexe'). asString := sSexe;[/FONT]
    [FONT=Times New Roman]    FieldByName('Date_Naissance'). asDateTime := sDNais;[/FONT]
    [FONT=Times New Roman]    FieldByName('Lieu_Naissance'). asString := sLN;[/FONT]
    [FONT=Times New Roman]    FieldByName('Adresse'). asString := sAdr;[/FONT]
    [FONT=Times New Roman]    FieldByName('SF'). asString := sSF;[/FONT]
    [FONT=Times New Roman]    FieldByName('Date_Rec'). asDateTime := sDRec;[/FONT]
    [FONT=Times New Roman]    FieldByName('Fonction'). asInteger := sFct;[/FONT]
    [FONT=Times New Roman]    FieldByName('Cat'). asString := sCat;[/FONT]
    [FONT=Times New Roman]    FieldByName('SBase'). asInteger := sSB;[/FONT]
    [FONT=Times New Roman]    FieldByName('Entreprise_Affect'). asString := sEAf;[/FONT]
    [FONT=Times New Roman]    FieldByName('Unite_Affect'). asInteger := sUAf;[/FONT]
    [FONT=Times New Roman]    FieldByName('Departement_Affect'). asInteger := sDAf;[/FONT]
    [FONT=Times New Roman]    FieldByName('Service_Affect'). asInteger := sSAf;[/FONT]
    [FONT=Times New Roman]    FieldByName('NSS'). asInteger := sNSS;[/FONT]
    [FONT=Times New Roman]    FieldByName('Date_Depart'). asDateTime:= sDDep;[/FONT]
    [FONT=Times New Roman]    FieldByName('Etat_Actuel'). asString := sEAct;[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman]    if GotoKey then begin[/FONT]
    [FONT=Times New Roman]      // données existantes[/FONT]
    [FONT=Times New Roman]      i := 1;[/FONT]
    [FONT=Times New Roman]      Repeat[/FONT]
    [FONT=Times New Roman]        SetKey;[/FONT]
    [FONT=Times New Roman]        FieldByName('Matricule'). asInteger := sMat + (i);[/FONT]
    [FONT=Times New Roman]        FieldByName('Nom').asString := 'sNom';[/FONT]
    [FONT=Times New Roman]        FieldByName('Prenom').asString := 'sPNom';[/FONT]
    [FONT=Times New Roman]        FieldByName('Sexe'). asString := 'sSexe';[/FONT]
    [FONT=Times New Roman]        FieldByName('Date_Naissance'). asDateTime := sDNais;[/FONT]
    [FONT=Times New Roman]        FieldByName('Lieu_Naissance'). asString := 'sLN';[/FONT]
    [FONT=Times New Roman]        FieldByName('Adresse'). asString := 'sAdr';[/FONT]
    [FONT=Times New Roman]        FieldByName('SF'). asString := 'sSF';[/FONT]
    [FONT=Times New Roman]        FieldByName('Date_Rec'). asString := 'sDRec';[/FONT]
    [FONT=Times New Roman]        FieldByName('Fonction'). asInteger := sFct;[/FONT]
    [FONT=Times New Roman]        FieldByName('Cat'). asString := 'sCat';[/FONT]
    [FONT=Times New Roman]        FieldByName('SBase'). asInteger := sSB;[/FONT]
    [FONT=Times New Roman]        FieldByName('Entreprise_Affect'). asString := 'sEAf';[/FONT]
    [FONT=Times New Roman]        FieldByName('Unite_Affect'). asString := 'sUAf';[/FONT]
    [FONT=Times New Roman]        FieldByName('Departement_Affect'). asInteger := sDAf;[/FONT]
    [FONT=Times New Roman]        FieldByName('Service_Affect'). asInteger := sSAf;[/FONT]
    [FONT=Times New Roman]        FieldByName('NSS'). asInteger := sNSS;[/FONT]
    [FONT=Times New Roman]        FieldByName('Date_Depart'). asDateTime:= sDDep;[/FONT]
    [FONT=Times New Roman]        FieldByName('Etat_Actuel'). asString := 'sEAct';[/FONT]
    [FONT=Times New Roman]        Inc(i);[/FONT]
    [FONT=Times New Roman]      Until not Gotokey;[/FONT]
    [FONT=Times New Roman]      sMat := sMat + (i);  // on n'écrase pas, on rajoute 1, 2, ...[/FONT]
    [FONT=Times New Roman]    end;[/FONT]
    [FONT=Times New Roman]    // ajoute[/FONT]
    [FONT=Times New Roman]    Append;[/FONT]
    [FONT=Times New Roman]    FieldByName('Matricule'). asInteger := sMat;[/FONT]
    [FONT=Times New Roman]    FieldByName('Nom').asString := sNom;[/FONT]
    [FONT=Times New Roman]    FieldByName('Prenom').asString := sPNom;[/FONT]
    [FONT=Times New Roman]    FieldByName('Sexe'). asString := sSexe;[/FONT]
    [FONT=Times New Roman]    FieldByName('Date_Naissance'). asDateTime := sDNais;[/FONT]
    [FONT=Times New Roman]    FieldByName('Lieu_Naissance'). asString := sLN;[/FONT]
    [FONT=Times New Roman]    FieldByName('Adresse'). asString := sAdr;[/FONT]
    [FONT=Times New Roman]    FieldByName('SF'). asString := sSF;[/FONT]
    [FONT=Times New Roman]    FieldByName('Date_Rec'). asdateTime := sDRec;[/FONT]
    [FONT=Times New Roman]    FieldByName('Fonction'). asInteger := sFct;[/FONT]
    [FONT=Times New Roman]    FieldByName('Cat'). asString := sCat;[/FONT]
    [FONT=Times New Roman]    FieldByName('SBase'). asInteger := sSB;[/FONT]
    [FONT=Times New Roman]    FieldByName('Entreprise_Affect'). asString := sEAf;[/FONT]
    [FONT=Times New Roman]    FieldByName('Unite_Affect'). asInteger:= sUAf;[/FONT]
    [FONT=Times New Roman]    FieldByName('Departement_Affect'). asInteger := sDAf;[/FONT]
    [FONT=Times New Roman]    FieldByName('Service_Affect'). asInteger := sSAf;[/FONT]
    [FONT=Times New Roman]    FieldByName('NSS'). asInteger := sNSS;[/FONT]
    [FONT=Times New Roman]    FieldByName('Date_Depart'). asDateTime:= sDDep;[/FONT]
    [FONT=Times New Roman]    FieldByName('Etat_Actuel'). asString := sEAct;[/FONT]
    [FONT=Times New Roman]    Post;[/FONT]
    [FONT=Times New Roman]  end;  // with[/FONT]
    [FONT=Times New Roman] end;[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman]end.[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman]end.[/FONT]
    aidez moi à résoudre ce pb

  2. #2
    Rédacteur
    Avatar de evarisnea
    Homme Profil pro
    Ingénieur intégration
    Inscrit en
    Juin 2005
    Messages
    1 957
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Ingénieur intégration
    Secteur : Transports

    Informations forums :
    Inscription : Juin 2005
    Messages : 1 957
    Points : 4 384
    Points
    4 384
    Par défaut
    salut,
    désolé de ne pas t'apporter de réponse maintenant, mais je te suggére plutot
    d'éditer ton post pour que le code que tu as envoyé soit plus lisible, parce que là ....

  3. #3
    Nouveau membre du Club
    Inscrit en
    Février 2006
    Messages
    66
    Détails du profil
    Informations forums :
    Inscription : Février 2006
    Messages : 66
    Points : 37
    Points
    37
    Par défaut Alors ????
    slt; voila mon nouveau code et il y a toujours un message c'est "converssion de type incorecte "

    procedure TForm1.Button1Click(Sender: TObject);
    var
    XlsWk:_workbook;
    XlsPage :_Worksheet;
    sFile: string;
    sNom, sPNom, sSexe, sLN, sAdr, sSF, sCat, sEAf, sEAct, sFct : string;
    sMat, sSB, sUAf, sDAf, sSAf, sNSS : integer ;
    sDNais, sDRec, sDDep: TdateTime;
    bFin: boolean;
    iLine: integer;
    begin[/FONT]
    XlsApp.Connect;
    XlsApp.Visible[0] := true;
    sFile := ExtractFilePath(Application.ExeName) + 'Base Données\BD FA';
    XlsWk := XlsApp.Workbooks.Open(sFile, False, False, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, 0)
    XlsPage := XlsWk.Worksheets['CopiedeDEB'] as _worksheet;
    DMGE.TEmpl.Open;
    bFin := false;
    iLine := 1;
    repeat
    // lire les données
    sMat := XlsPage.Cells.Item[iLine, 1].Value;
    sNom := XlsPage.Cells.Item[iLine, 2].Value;
    sPNom := XlsPage.Cells.Item[iLine, 3].Value;
    sSexe := XlsPage.Cells.Item[iLine, 4].Value;
    sDNais := XlsPage.Cells.Item[iLine, 5].Value;
    sLN := XlsPage.Cells.Item[iLine, 6].Value;
    sAdr := XlsPage.Cells.Item[iLine, 7].Value;
    sSF := XlsPage.Cells.Item[iLine, 8].Value;
    sDRec := XlsPage.Cells.Item[iLine, 9].Value;
    sFct := XlsPage.Cells.Item[iLine, 10].Value;
    sCat := XlsPage.Cells.Item[iLine, 11].Value;
    sSB := XlsPage.Cells.Item[iLine, 12].Value;
    sEAf := XlsPage.Cells.Item[iLine, 13].Value;
    sUAf := XlsPage.Cells.Item[iLine, 14].Value;
    sDAf := XlsPage.Cells.Item[iLine, 15].Value;
    sSAf := XlsPage.Cells.Item[iLine, 16].Value;
    sNSS := XlsPage.Cells.Item[iLine, 17].Value;
    sDDep := XlsPage.Cells.Item[iLine, 18].Value;
    sEAct := XlsPage.Cells.Item[iLine, 19].Value;

    if sMat = 0 then
    Break; // fin des données XLS
    // met à jour la table

    Times New Roman] SaveInBD(sNom, sPNom, sSexe, sLN, sAdr, sSF, sCat, sEAf, sEAct, sFct ,
    sMat, sSB, sUAf, sDAf, sSAf, sNSS ,
    sDNais, sDRec, sDDep);[/FONT]
    Inc(iLine); // ligne suivante dans XLS
    Until bFin;
    end;
    procedure TForm1.SaveInBD(sNom, sPNom, sSexe, sLN, sAdr, sSF, sCat, sEAf, sEAct, sFct : string;
    sMat, sSB, sUAf, sDAf, sSAf, sNSS : integer ;
    sDNais, sDRec, sDDep: TdateTime);
    var
    i: integer;
    begin
    with DMGE.TEmpl do begin
    SetKey;[/FONT]
    FieldByName('Matricule'). asInteger := sMat;
    FieldByName('Nom'). asString := sNom;
    FieldByName('Prenom'). asString := sPNom;
    FieldByName('Sexe'). asString := sSexe;
    FieldByName('Date_Naissance'). asDateTime := sDNais;
    FieldByName('Lieu_Naissance'). asString := sLN;
    FieldByName('Adresse'). asString := sAdr;
    FieldByName('SF'). asString := sSF;
    FieldByName('Date_Rec'). asDateTime := sDRec;
    FieldByName('Fonction'). asString := sFct;
    FieldByName('Cat'). asString := sCat;
    FieldByName('SBase'). asInteger := sSB;
    FieldByName('Entreprise_Affect'). asString := sEAf;
    FieldByName('Unite_Affect'). asInteger := sUAf;
    FieldByName('Departement_Affect'). asInteger := sDAf;
    FieldByName('Service_Affect'). asInteger := sSAf;
    FieldByName('NSS'). asInteger := sNSS;
    FieldByName('Date_Depart'). asDateTime:= sDDep;
    FieldByName('Etat_Actuel'). asString := sEAct;

    if GotoKey then begin[/FONT]
    // données existantes[/FONT]
    i := 1;
    Repeat
    SetKey;
    FieldByName('Matricule'). asInteger := sMat + (i);
    FieldByName('Nom').asString := 'sNom';
    FieldByName('Prenom').asString := 'sPNom';
    FieldByName('Sexe'). asString := 'sSexe';
    FieldByName('Date_Naissance'). asDateTime := sDNais;
    FieldByName('Lieu_Naissance'). asString := 'sLN';
    FieldByName('Adresse'). asString := 'sAdr';
    FieldByName('SF'). asString := 'sSF';
    FieldByName('Date_Rec'). asString := 'sDRec';
    FieldByName('Fonction'). asString := 'sFct';
    FieldByName('Cat'). asString := 'sCat';
    FieldByName('SBase'). asInteger := sSB;
    FieldByName('Entreprise_Affect'). asString := 'sEAf';
    FieldByName('Unite_Affect'). asString := 'sUAf';
    FieldByName('Departement_Affect'). asInteger := sDAf;
    FieldByName('Service_Affect'). asInteger := sSAf;
    FieldByName('NSS'). asInteger := sNSS;
    FieldByName('Date_Depart'). asDateTime:= sDDep;
    FieldByName('Etat_Actuel'). asString := 'sEAct';
    Inc(i);
    Until not Gotokey;
    sMat := sMat + (i); // on n'écrase pas, on rajoute 1, 2, ...
    end;[/FONT]
    // ajoute[/FONT]
    Append;[/FONT]
    FieldByName('Matricule'). asInteger := sMat;
    FieldByName('Nom').asString := sNom;
    FieldByName('Prenom').asString := sPNom;
    FieldByName('Sexe'). asString := sSexe;
    FieldByName('Date_Naissance'). asDateTime := sDNais;
    FieldByName('Lieu_Naissance'). asString := sLN;
    FieldByName('Adresse'). asString := sAdr;
    FieldByName('SF'). asString := sSF;
    FieldByName('Date_Rec'). asdateTime := sDRec;
    FieldByName('Fonction'). asString := sFct;
    FieldByName('Cat'). asString := sCat;
    FieldByName('SBase'). asInteger := sSB;
    FieldByName('Entreprise_Affect'). asString := sEAf;
    FieldByName('Unite_Affect'). asInteger:= sUAf;
    FieldByName('Departement_Affect'). asInteger := sDAf;
    FieldByName('Service_Affect'). asInteger := sSAf;
    FieldByName('NSS'). asInteger := sNSS;
    FieldByName('Date_Depart'). asDateTime:= sDDep;
    FieldByName('Etat_Actuel'). asString := sEAct;
    Post;
    end; // with
    end;

    que dois je faire

  4. #4
    Nouveau membre du Club
    Inscrit en
    Février 2006
    Messages
    66
    Détails du profil
    Informations forums :
    Inscription : Février 2006
    Messages : 66
    Points : 37
    Points
    37
    Par défaut Alors ????
    slt; voila mon nouveau code et il y a toujours un message c'est "converssion de type incorecte "

    [FONT=Times New Roman]procedure TForm1.Button1Click(Sender: TObject);[/FONT]
    [FONT=Times New Roman]var[/FONT]
    [FONT=Times New Roman] XlsWk:_workbook;[/FONT]
    [FONT=Times New Roman] XlsPage :_Worksheet;[/FONT]
    [FONT=Times New Roman] sFile: string;[/FONT]
    [FONT=Times New Roman] sNom, sPNom, sSexe, sLN, sAdr, sSF, sCat, sEAf, sEAct, sFct : string;[/FONT]
    [FONT=Times New Roman] sMat, sSB, sUAf, sDAf, sSAf, sNSS : integer ;[/FONT]
    [FONT=Times New Roman] sDNais, sDRec, sDDep: TdateTime;[/FONT]
    [FONT=Times New Roman] bFin: boolean;[/FONT]
    [FONT=Times New Roman] iLine: integer;[/FONT]
    [FONT=Times New Roman] begin[/FONT]
    [FONT=Times New Roman] XlsApp.Connect;[/FONT]
    [FONT=Times New Roman] XlsApp.Visible[0] := true;[/FONT]
    [FONT=Times New Roman] sFile := ExtractFilePath(Application.ExeName) + 'Base Données\BD FA';[/FONT]
    [FONT=Times New Roman] XlsWk := XlsApp.Workbooks.Open(sFile, False, False, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, 0);[/FONT]
    [FONT=Times New Roman] XlsPage := XlsWk.Worksheets['CopiedeDEB'] as _worksheet;[/FONT]
    [FONT=Times New Roman] DMGE.TEmpl.Open;[/FONT]
    [FONT=Times New Roman] bFin := false;[/FONT]
    [FONT=Times New Roman] iLine := 1;[/FONT]
    [FONT=Times New Roman] repeat[/FONT]
    [FONT=Times New Roman] // lire les données[/FONT]
    [FONT=Times New Roman] sMat := XlsPage.Cells.Item[iLine, 1].Value;[/FONT]
    [FONT=Times New Roman] sNom := XlsPage.Cells.Item[iLine, 2].Value;[/FONT]
    [FONT=Times New Roman] sPNom := XlsPage.Cells.Item[iLine, 3].Value;[/FONT]
    [FONT=Times New Roman] sSexe := XlsPage.Cells.Item[iLine, 4].Value;[/FONT]
    [FONT=Times New Roman] sDNais := XlsPage.Cells.Item[iLine, 5].Value;[/FONT]
    [FONT=Times New Roman] sLN := XlsPage.Cells.Item[iLine, 6].Value;[/FONT]
    [FONT=Times New Roman] sAdr := XlsPage.Cells.Item[iLine, 7].Value;[/FONT]
    [FONT=Times New Roman] sSF := XlsPage.Cells.Item[iLine, 8].Value;[/FONT]
    [FONT=Times New Roman] sDRec := XlsPage.Cells.Item[iLine, 9].Value;[/FONT]
    [FONT=Times New Roman] sFct := XlsPage.Cells.Item[iLine, 10].Value;[/FONT]
    [FONT=Times New Roman] sCat := XlsPage.Cells.Item[iLine, 11].Value;[/FONT]
    [FONT=Times New Roman] sSB := XlsPage.Cells.Item[iLine, 12].Value;[/FONT]
    [FONT=Times New Roman] sEAf := XlsPage.Cells.Item[iLine, 13].Value;[/FONT]
    [FONT=Times New Roman] sUAf := XlsPage.Cells.Item[iLine, 14].Value;[/FONT]
    [FONT=Times New Roman] sDAf := XlsPage.Cells.Item[iLine, 15].Value;[/FONT]
    [FONT=Times New Roman] sSAf := XlsPage.Cells.Item[iLine, 16].Value;[/FONT]
    [FONT=Times New Roman] sNSS := XlsPage.Cells.Item[iLine, 17].Value;[/FONT]
    [FONT=Times New Roman] sDDep := XlsPage.Cells.Item[iLine, 18].Value;[/FONT]
    [FONT=Times New Roman] sEAct := XlsPage.Cells.Item[iLine, 19].Value;[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman] if sMat = 0 then[/FONT]
    [FONT=Times New Roman] Break; // fin des données XLS[/FONT]
    [FONT=Times New Roman] // met à jour la table[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman] SaveInBD(sNom, sPNom, sSexe, sLN, sAdr, sSF, sCat, sEAf, sEAct, sFct ,[/FONT]
    [FONT=Times New Roman] sMat, sSB, sUAf, sDAf, sSAf, sNSS ,[/FONT]
    [FONT=Times New Roman] sDNais, sDRec, sDDep);[/FONT]
    [FONT=Times New Roman] //(sMat,sNom, sPNom, sSexe, sDNais, sLN, sAdr, sSF, sDRec, sFct,sCat,sSB,sEAct, sUAf, sDAf, sSAf, sNSS, sDDep, sEAct);[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman] Inc(iLine); // ligne suivante dans XLS[/FONT]
    [FONT=Times New Roman] Until bFin;[/FONT]
    [FONT=Times New Roman] end;[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman]procedure TForm1.SaveInBD(sNom, sPNom, sSexe, sLN, sAdr, sSF, sCat, sEAf, sEAct, sFct : string;[/FONT]
    [FONT=Times New Roman] sMat, sSB, sUAf, sDAf, sSAf, sNSS : integer ;[/FONT]
    [FONT=Times New Roman] sDNais, sDRec, sDDep: TdateTime);[/FONT]
    [FONT=Times New Roman] var[/FONT]
    [FONT=Times New Roman] i: integer;[/FONT]
    [FONT=Times New Roman] begin[/FONT]
    [FONT=Times New Roman] with DMGE.TEmpl do begin[/FONT]
    [FONT=Times New Roman] SetKey;[/FONT]
    [FONT=Times New Roman] FieldByName('Matricule'). asInteger := sMat;[/FONT]
    [FONT=Times New Roman] FieldByName('Nom'). asString := sNom;[/FONT]
    [FONT=Times New Roman] FieldByName('Prenom'). asString := sPNom;[/FONT]
    [FONT=Times New Roman] FieldByName('Sexe'). asString := sSexe;[/FONT]
    [FONT=Times New Roman] FieldByName('Date_Naissance'). asDateTime := sDNais;[/FONT]
    [FONT=Times New Roman] FieldByName('Lieu_Naissance'). asString := sLN;[/FONT]
    [FONT=Times New Roman] FieldByName('Adresse'). asString := sAdr;[/FONT]
    [FONT=Times New Roman] FieldByName('SF'). asString := sSF;[/FONT]
    [FONT=Times New Roman] FieldByName('Date_Rec'). asDateTime := sDRec;[/FONT]
    [FONT=Times New Roman] FieldByName('Fonction'). asString := sFct;[/FONT]
    [FONT=Times New Roman] FieldByName('Cat'). asString := sCat;[/FONT]
    [FONT=Times New Roman] FieldByName('SBase'). asInteger := sSB;[/FONT]
    [FONT=Times New Roman] FieldByName('Entreprise_Affect'). asString := sEAf;[/FONT]
    [FONT=Times New Roman] FieldByName('Unite_Affect'). asInteger := sUAf;[/FONT]
    [FONT=Times New Roman] FieldByName('Departement_Affect'). asInteger := sDAf;[/FONT]
    [FONT=Times New Roman] FieldByName('Service_Affect'). asInteger := sSAf;[/FONT]
    [FONT=Times New Roman] FieldByName('NSS'). asInteger := sNSS;[/FONT]
    [FONT=Times New Roman] FieldByName('Date_Depart'). asDateTime:= sDDep;[/FONT]
    [FONT=Times New Roman] FieldByName('Etat_Actuel'). asString := sEAct;[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman] if GotoKey then begin[/FONT]
    [FONT=Times New Roman] // données existantes[/FONT]
    [FONT=Times New Roman] i := 1;[/FONT]
    [FONT=Times New Roman] Repeat[/FONT]
    [FONT=Times New Roman] SetKey;[/FONT]
    [FONT=Times New Roman] FieldByName('Matricule'). asInteger := sMat + (i);[/FONT]
    [FONT=Times New Roman] FieldByName('Nom').asString := 'sNom';[/FONT]
    [FONT=Times New Roman] FieldByName('Prenom').asString := 'sPNom';[/FONT]
    [FONT=Times New Roman] FieldByName('Sexe'). asString := 'sSexe';[/FONT]
    [FONT=Times New Roman] FieldByName('Date_Naissance'). asDateTime := sDNais;[/FONT]
    [FONT=Times New Roman] FieldByName('Lieu_Naissance'). asString := 'sLN';[/FONT]
    [FONT=Times New Roman] FieldByName('Adresse'). asString := 'sAdr';[/FONT]
    [FONT=Times New Roman] FieldByName('SF'). asString := 'sSF';[/FONT]
    [FONT=Times New Roman] FieldByName('Date_Rec'). asString := 'sDRec';[/FONT]
    [FONT=Times New Roman] FieldByName('Fonction'). asString := 'sFct';[/FONT]
    [FONT=Times New Roman] FieldByName('Cat'). asString := 'sCat';[/FONT]
    [FONT=Times New Roman] FieldByName('SBase'). asInteger := sSB;[/FONT]
    [FONT=Times New Roman] FieldByName('Entreprise_Affect'). asString := 'sEAf';[/FONT]
    [FONT=Times New Roman] FieldByName('Unite_Affect'). asString := 'sUAf';[/FONT]
    [FONT=Times New Roman] FieldByName('Departement_Affect'). asInteger := sDAf;[/FONT]
    [FONT=Times New Roman] FieldByName('Service_Affect'). asInteger := sSAf;[/FONT]
    [FONT=Times New Roman] FieldByName('NSS'). asInteger := sNSS;[/FONT]
    [FONT=Times New Roman] FieldByName('Date_Depart'). asDateTime:= sDDep;[/FONT]
    [FONT=Times New Roman] FieldByName('Etat_Actuel'). asString := 'sEAct';[/FONT]
    [FONT=Times New Roman] Inc(i);[/FONT]
    [FONT=Times New Roman] Until not Gotokey;[/FONT]
    [FONT=Times New Roman] sMat := sMat + (i); // on n'écrase pas, on rajoute 1, 2, ...[/FONT]
    [FONT=Times New Roman] end;[/FONT]
    [FONT=Times New Roman] // ajoute[/FONT]
    [FONT=Times New Roman] Append;[/FONT]
    [FONT=Times New Roman] FieldByName('Matricule'). asInteger := sMat;[/FONT]
    [FONT=Times New Roman] FieldByName('Nom').asString := sNom;[/FONT]
    [FONT=Times New Roman] FieldByName('Prenom').asString := sPNom;[/FONT]
    [FONT=Times New Roman] FieldByName('Sexe'). asString := sSexe;[/FONT]
    [FONT=Times New Roman] FieldByName('Date_Naissance'). asDateTime := sDNais;[/FONT]
    [FONT=Times New Roman] FieldByName('Lieu_Naissance'). asString := sLN;[/FONT]
    [FONT=Times New Roman] FieldByName('Adresse'). asString := sAdr;[/FONT]
    [FONT=Times New Roman] FieldByName('SF'). asString := sSF;[/FONT]
    [FONT=Times New Roman] FieldByName('Date_Rec'). asdateTime := sDRec;[/FONT]
    [FONT=Times New Roman] FieldByName('Fonction'). asString := sFct;[/FONT]
    [FONT=Times New Roman] FieldByName('Cat'). asString := sCat;[/FONT]
    [FONT=Times New Roman] FieldByName('SBase'). asInteger := sSB;[/FONT]
    [FONT=Times New Roman] FieldByName('Entreprise_Affect'). asString := sEAf;[/FONT]
    [FONT=Times New Roman] FieldByName('Unite_Affect'). asInteger:= sUAf;[/FONT]
    [FONT=Times New Roman] FieldByName('Departement_Affect'). asInteger := sDAf;[/FONT]
    [FONT=Times New Roman] FieldByName('Service_Affect'). asInteger := sSAf;[/FONT]
    [FONT=Times New Roman] FieldByName('NSS'). asInteger := sNSS;[/FONT]
    [FONT=Times New Roman] FieldByName('Date_Depart'). asDateTime:= sDDep;[/FONT]
    [FONT=Times New Roman] FieldByName('Etat_Actuel'). asString := sEAct;[/FONT]
    [FONT=Times New Roman] Post;[/FONT]
    [FONT=Times New Roman] end; // with[/FONT]
    [FONT=Times New Roman] end;[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman]end.[/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman][/FONT]
    [FONT=Times New Roman]end.[/FONT]

  5. #5
    Rédacteur
    Avatar de evarisnea
    Homme Profil pro
    Ingénieur intégration
    Inscrit en
    Juin 2005
    Messages
    1 957
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Ingénieur intégration
    Secteur : Transports

    Informations forums :
    Inscription : Juin 2005
    Messages : 1 957
    Points : 4 384
    Points
    4 384
    Par défaut
    ca te donne ce message d'erreur à la compilation ou à l'exécution ?
    si c'est à l'exécution, sur quelle ligne est ce que ce message apparait ?

  6. #6
    Nouveau membre du Club
    Inscrit en
    Février 2006
    Messages
    66
    Détails du profil
    Informations forums :
    Inscription : Février 2006
    Messages : 66
    Points : 37
    Points
    37
    Par défaut Merci
    slt;
    c'est à l'exécution et il ne fixe sur aucune ligne dans le programme .

  7. #7
    Rédacteur
    Avatar de evarisnea
    Homme Profil pro
    Ingénieur intégration
    Inscrit en
    Juin 2005
    Messages
    1 957
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Ingénieur intégration
    Secteur : Transports

    Informations forums :
    Inscription : Juin 2005
    Messages : 1 957
    Points : 4 384
    Points
    4 384
    Par défaut
    met un point d'arrêt sur la ligne begin de ton code, puis tu lance le programme sous l'IDE, lorsque ton programme fera appel à ta procédure, delphi passera en mode débogage. utilise alors le débogage pas à pas pour voir exactement sur quelle instruction ca plante et donne nous le message d'erreur renvoyé.
    ps: avant de poster ton message, clique d'abord sur le bouton prévisualisation du message pour voir de quoi il a l'air, parce que là franchement, je ne suis pas prêt à me foirer les yeux pour essayer de lire ton code. de plus pense à utiliser la balise Code pour tes codes (c'est l'icone avec le signe dièse). encore une chose, tu peux à tout moment éditer ton message pour lui apporter des modifications et autres corrections nécessaires

Discussions similaires

  1. Donnée feuille Excel vers table base Access
    Par LE MAHJONG dans le forum Bases de données
    Réponses: 13
    Dernier message: 06/10/2008, 21h15
  2. [MySQL] fichier Excel vers Table BD MySQL
    Par sidimatique dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 12/08/2008, 12h19
  3. données tableau excel vers table access ?
    Par alexkickstand dans le forum Macros et VBA Excel
    Réponses: 6
    Dernier message: 24/09/2007, 21h11
  4. Importer des données d'une feuille Excel vers TABLE
    Par souminet dans le forum Bases de données
    Réponses: 1
    Dernier message: 07/11/2006, 09h10
  5. [débutant] importation de données d'excel vers table
    Par vivelesgnous dans le forum Access
    Réponses: 6
    Dernier message: 24/02/2006, 21h13

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