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
|
Imports System.Xml
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
Dim connetionString As String
Dim connection As SqlConnection
Dim command As SqlCommand
Dim adpter As New SqlDataAdapter
Dim ds As New DataSet
Dim xmlFile As XmlReader
Dim sql As String
Dim libelleType As String
Dim sdate As String
Dim heure As String
Dim numeroAppele As String
Dim destination As String
Dim duree As String
Dim montantHT As String
connetionString = "server=(local);integrated security=true;database=facture_telephonique"
connection = New SqlConnection(connetionString)
connection.Open()
xmlFile = XmlReader.Create("c:\fact200906_5.18143_0_0523430910_.xml", New XmlReaderSettings())
ds.ReadXml(xmlFile)
Dim r As DataRow = ds.Tables("numeroAppel").Rows(0)
Dim s As String = r(0)
MsgBox(s)
For Each row As DataRow In ds.Tables("ligne").Rows
libelleType = row("libelleType").ToString
sdate = row("date").ToString
heure = row("heure").ToString
numeroAppele = row("numeroAppele").ToString
destination = row("destination").ToString
duree = row("duree").ToString
montantHT = row("montantHT").ToString
If libelleType <> "" Then
'ComboBox1.Items.Add(mlibelleType & " " & mdate & " " & mheure & " " & mnumeroAppele & " " & mdestination & " " & mduree & " " & mmontantHT)
sql = "insert into Detail values('" & s & "','" & libelleType & "','" & sdate & "','" & heure & "','" & numeroAppele & "','" & destination & "','" & duree & "','" & montantHT & "')"
command = New SqlCommand(sql, connection)
adpter.InsertCommand = command
adpter.InsertCommand.ExecuteNonQuery()
End If
Next
connection.Close()
End Sub
End Class |
Partager