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
|
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim date1,date2 as DateTime
Dim connexion As New SqlConnection("....")
Protected Sub Date_Debut_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Date_Debut.TextChanged
date1 = CDate(Date_Debut.Text)
End Sub
Protected Sub Date_Fin_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Date_Fin.TextChanged
date2 = CDate(Date_Fin.Text)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
connexion.Open()
Dim requete As String = "SELECT infos1,infos2 FROM TaTable WHERE ChampDate BETWEEN '" & date1 & "' AND '" & date2 & "' "
Dim commande As New SqlCommand(requete, connexion)
Dim adaptateur As New SqlDataAdapter(commande)
Dim TonDataSet as New DataSet
adaptateur.Fill(TonDataSet, "selection")
connexion.Close()
GridView1.DataSource =TonDataSet.Tables("selection")
GridView1.DataBind()
End Sub
End Class |
Partager