Datagrid показывает неправильный вывод в vb6
when i choose same date from month 10(say dtpckr1 = 02-10-2019 and dtpckr2 = 02-10-2019 ) ..data datagrid does not print anything and shows the msgbox not record found which i code for convinence...but when i choose start date from last moth and end date in this month(say dtpckr1 = 30-09-2019 and dtpckr2 = 02-10-2019 ) it shows all the data from month 09 and nothing from month 10 ... and the strange this is when choose date which is from moth 09 even if it is same(say dtpckr1 = 13-09-2019 and dtpckr2 = 13-09-2019 or 22-09-2019) it works perfectly i tried to attach screen shots but ..it showing server error...so please try to help me out by refering the following code .. I also checked the dataformat of database and my input,they are same...in databse the date datatype is "date/time" and format is "short date"....if have any other solution then please tell me... i will try... my purpose it to show datewise food orders in datagridview and then calculate the total sale... thanks
Что я уже пробовал:
Dim con As New ADODB.Connection Dim rs As New ADODB.Recordset Private Sub cmdSearch_Click() Dim date1 As Date Dim date2 As Date If IsNull(DTPicker1.Value And DTPicker2.Value) Then MsgBox "You must select date", vbCritical, "Warning" Exit Sub End If DTPicker1.Value = Format(DTPicker1.Value, "dd-mm-yyyy") DTPicker2.Value = Format(DTPicker2.Value, "dd-mm-yyyy") date1 = DTPicker1.Value date2 = DTPicker2.Value con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\OrderMania\ordermania.mdb;Persist Security Info=False" rs.CursorLocation = adUseClient If DTPicker2.Value < DTPicker1.Value Then MsgBox "End Date Cannot Be Lesser Then Start Date", vbCritical, "Wrong Input" Exit Sub Else Adodc1.RecordSource = "select * from order1 where (date between #" & date1 & "# and #" & DTPicker2.Value & "#)" Adodc1.Refresh If Adodc1.Recordset.EOF Then MsgBox "Please Enter Another Date", vbCritical, "No Record Found" Else Adodc1.Caption = Adodc1.RecordSource End If End If con.Close Call sale End Sub Public Sub sale() Dim i As Integer Dim Tot, gst, gtot As Double For i = 0 To Adodc1.Recordset.RecordCount - 1 Tot = Tot + CDbl(DataGrid1.Columns(5).Text) Adodc1.Recordset.MoveNext Next i Text1.Text = Tot gst = Tot * 0.05 Text2.Text = gst gtot = Tot + gst Text3.Text = gtot End Sub