i am having table in ms access named as stockitems, table structure is..
stdate stitems
01-04-2015 Red
02-04-2015 Blue
08-04-2015 Green
01-05-2015 Grey
02-05-2015 Violet
09-05-2015 Purple
04-06-2015 Sky Blue
i am using the below code to select records from that table...
Dim report As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim xs, xs2, cmp As String
xs = date1.Text
xs2 = date2.Text
cmp = salsqkrpt.salcom.Text
Dim cmd1 As OleDbCommand = New OleDbCommand("SELECT * from stockitems where stdate between '" & date1.Text & "'and '" & date2.Text & "'",con)
myDA = New OleDbDataAdapter(cmd1)
myDataSet = New DataSet()
myDA.Fill(myDataSet, "stockitems ")
report.Load(Application.StartupPath & "\stockreport.rpt")
report.SetDataSource(myDataSet.Tables("stockitems "))
stckreport.CrystalReportViewer1.ReportSource = report
here date1 and date2 was masked textbox ,mask is 00-00-0000 (DD-MM-YYYY)
when excuting this code the report only get from first two strings only that is dd only,when i assign date1=01-04-2015 and date2=03-05-2015 the result comes like...
stdate stitems
01-04-2015 Red
02-04-2015 Blue
01-05-2015 Grey
02-05-2015 Violet
but my expected result is
stdate stitems
01-04-2015 Red
02-04-2015 Blue
08-04-2015 Green
01-05-2015 Grey
02-05-2015 Violet
it does'nt works as a date please help me out of this problem developers and i am beginner to vb.net. thanks in advance.
stdatecolumn in the database? It needs to be "Date/Time" if you want to use dates reliably and without horrible complications.