Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Private Sub btnsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsearch.Click
Try
Dim con As New SqlConnection("Initial Catalog=stock;Data source=.\sqlexpress;integrated security=true;")
Dim da2 As New SqlDataAdapter("select * from stockentry where [Purchase Date] BETWEEN '" + comboBox1.Text + "'AND '" + ComboBox2.Text + "' order by[Purchase Date]", con)
Dim ds2 As New DataSet
da2.Fill(ds2)

CrystalReportViewer1.RefreshReport()
CrystalReportViewer1.SelectionFormula = "{stockentry.Purchase Date}= '" & comboBox1.Text & "' TO {stockentry.Purchase Date} = '" & ComboBox2.Text & "'"
CrystalReportViewer1.RefreshReport()

Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub


I get error and its not displaying between specific ranges. I use combo boxes
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900