Im creating a site that will display a number from a database of how many tickets there are.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim com As New SqlCommand("select count(id) from tickets where opened > @opn", con)
com.Parameters.AddWithValue("@opn", "08/11/2010 ")
con.Open()
Dim cnt As Integer = com.ExecuteScalar()
con.Close()
lbltoday.Text = cnt
End Sub
I need it to be able to get the current date and then make it so it has paramaters so that it displays only tickets from past 7 days from current date.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim com As New SqlCommand("select count(id) from tickets where opened > @opn", con)
com.Parameters.AddWithValue("@opn", "08/11/2010 ")
con.Open()
Dim cnt As Integer = com.ExecuteScalar()
con.Close()
lbltoday.Text = cnt
End Sub
I need it to be able to get the current date and then make it so it has paramaters so that it displays only tickets from past 7 days from current date.