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
| Using createTableCommand = connection.CreateCommand()
createTableCommand.CommandText = "create table stats_postes(poste integer not null, nbAppelTotal integer not null, nbAppelEntrant integer not null, nbAppelSortant integer not null, dureeTotale real not null, dureeMoyenne real not null)"
createTableCommand.ExecuteNonQuery()
End Using
Using command = connection.CreateCommand()
command.CommandText = "insert into stats_postes(poste, nbAppelTotal, nbAppelEntrant, nbAppelSortant, dureeTotale, dureeMoyenne)" _
& "values (@poste, @nbAppelTotal, @nbAppelEntrant, @nbAppelSortant, @dureeTotale, @dureeMoyenne)"
command.Parameters.Add("@poste", DbType.Int32)
command.Parameters.Add("@nbAppelTotal", DbType.Int32)
command.Parameters.Add("@nbAppelEntrant", DbType.Int32)
command.Parameters.Add("@nbAppelSortant", DbType.Int32)
command.Parameters.Add("@dureeTotale", DbType.Double)
command.Parameters.Add("@dureeMoyenne", DbType.Double)
command.Prepare()
Dim doc = XDocument.Load("D:\tmp\blob.xml")
Dim tables = doc.<WINDEV_TABLE>.<Table>
For Each t in tables
' Récupération des valeurs
Dim poste = CInt(t.<Poste_>.Single())
Dim nbAppelTotal = CInt(t.<Nbre_appel_total>.Single())
Dim nbAppelEntrant = CInt(t.<Nbre_appel_entrant>.Single())
Dim nbAppelSortant = CInt(t.<Nbre_appel_sortant>.Single())
Dim dureeTotale = CDbl(t.<Durée_totale>.Single())
Dim dureeMoyenne = CDbl(t.<Durée_moyenne>.Single())
' Insertion des données dans la table
command.Parameters("@poste").Value = poste
command.Parameters("@nbAppelTotal").Value = nbAppelTotal
command.Parameters("@nbAppelEntrant").Value = nbAppelEntrant
command.Parameters("@nbAppelSortant").Value = nbAppelSortant
command.Parameters("@dureeTotale").Value = dureeTotale
command.Parameters("@dureeMoyenne").Value = dureeMoyenne
command.ExecuteNonQuery()
Next
End Using |
Partager