Search Data between two dates using VB.Net and sql server

  • Thread starter Thread starter NishanthDev
  • Start date Start date
N

NishanthDev

Guest
Hi, I'm new to programming. I have created a small program with and I want to show data in the data grid view between two dates interval. I have written code for this function but its not showing the exact date range. kindly looking for someone help to fix this issue.

my code,

Imports System.Data.SqlClient
Public Class Report1
Dim con As New SqlConnection
Private Sub SalesReportBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)
Me.Validate()
Me.SalesReportBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.SalesDataSet)

End Sub


Private Sub Report1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'SalesDataSet.SalesReport' table. You can move, or remove it, as needed.
Me.SalesReportTableAdapter.Fill(Me.SalesDataSet.SalesReport)

End Sub


Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnSearch.Click

Me.SalesReportBindingSource.Filter = "Date >= '" & txtFrom.Text & "' and Date <= '" & txtTo.Text & "'"



End Sub

End Class

Continue reading...
 
Back
Top