我正在使用 adatagridview
来显示学生记录..
我想显示按房东出生日期过滤的记录。
datetimepicker
当我通过使用自定义格式从 a 中选择 11/09 来搜索数据时dd/mm
,它什么也没显示。
如何通过仅匹配 dd/mm 而忽略年份来显示所有记录?
这是我的代码:
Try
con = New OleDbConnection(cs)
con.Open()
cmd = New OleDbCommand("SELECT HostelerID as [Hosteler ID],HostelerName as [Hosteler Name],DOB,HostelName as [Hostel Name],RoomNo as [Room No],DateOfJoining as [Date Of Joining],Purpose,FatherName as [Father's Name],MobNo1 as [Mobile No],Phone1 as [Phone No],MotherName as [Mother's Name],MobNo2 as [Mobile No 2],City,Address,Email,ContactNo as [Contact No],InstOfcDetails as [Ins/Ofc Details],Phone2 as [Phone No 2],Agreement,GuardianName as [Guardian Name],GuardianAddress as [Guardian Address],MobNo3 as [Guardian Mobile No],Phone3 as [Guardian Phone No],FixedDeposit as [Fixed Deposit],CompletionDate as [Completion Date],Photo,DocsPic as [Docs Pic] from Hostelers where DOB like #" & DateTimePicker1.Text & "# order by HostelerName", con)
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim myDataSet As DataSet = New DataSet()
myDA.Fill(myDataSet, "Hostelers")
DataGridView6.DataSource = myDataSet.Tables("Hostelers").DefaultView
con.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try