SQL Select Between Two Dates
i need to filter my table between 2 dates
but it makes wrong filtering really i dont understand why. but it might be my wrong codes
here is my codes... what should i do?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim da As New SqlDataAdapter("SELECT * FROM TableName WHERE DateColumn BETWEEN '" & _
DateTimePicker1.Value & "' AND '" & DateTimePicker2.Value & "'", Connection)
Dim dt As New DataTable
da.Fill(dt)
Dim dv As New DataView(dt)
DataGridView1.DataSource = dv
End Sub
Thanks for your helping :)
Related Article: SQL SELECT statement
is a VB.NET discussion thread by mikeybware that has 2 replies, was last updated 1 year ago and has been tagged with the keywords: sql, select, vb.
Oneryavuz
Junior Poster in Training
70 posts since Jul 2011
Reputation Points: 10
Solved Threads: 3
Skill Endorsements: 0
It's returning something it shouldn't.
Also its works ===> DateTimePicker.Value.ToString("yyyy-MM-dd")
ahh right now i understand....
Thank you very much :)
Oneryavuz
Junior Poster in Training
70 posts since Jul 2011
Reputation Points: 10
Solved Threads: 3
Skill Endorsements: 0
Question Answered as of 9 Months Ago by
AleMonteiro