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
| Dim app As New Microsoft.Office.Interop.Excel.Application
app.Workbooks.Open(System.Environment.CurrentDirectory & "\etat2.xls")
app.Visible = True
'dss.Clear()
Call connect()
Cmd.CommandText = "select N_ARRIVE,NOM_EXPD,DATE_ARRIVE,LIBELLE_DEPART from v1 where (DATE_ARRIVE between '" & Me.DateTimePicker1.Value & "' and '" & Me.DateTimePicker2.Value & "') and LIBELLE_DEPART like '" & Me.ComboBox1.Text & "'"
'Cmd.CommandText = "select N_ARRIVE,NOM_EXPD,DATE_ARRIVE,LIBELLE_DEPART from v1 "
Cmd.Connection = Cnx
Cmd.CommandType = CommandType.Text
dr = Cmd.ExecuteReader
Dim i As Integer = 0
dr.Read()
app.Cells(2, 3) = dr(3)
While dr.Read
app.Cells(6 + i, 1) = dr(0)
app.Cells(6 + i, 2) = dr(1)
app.Cells(6 + i, 3) = dr(2)
i = +1
End While
'app.Visible = True
'app.Workbooks.Add()
dr.Close()
Cnx.Close()
app.Worksheets.PrintPreview() |
Partager