本文介绍了需要在数据库中搜索标准是日期字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我需要您的紧急帮助解决以下问题..
我正在尝试使用Access表填充DataGridView,但所选数据保持以下多个条件,问题是它没有正确导致错误MSG出现
以下代码需要解决..
PS:如果我删除日期部分查询得到正确执行但我需要紧急的日期标准plz
Hi All,
please i need your urgent help in solving the below problem..
I'm trying to fill a DataGridView with Access table but the selected data holding the below multiple criteria , the problem that it didn't results correctly as an error MSG appeared
below codes needs to be solved please..
P.S: if i removed the date section the query got executed correctly but i need the date criteria urgently plz
Private Sub Supplier_Query()
Dim Yesterday As DateTime = DateTime.Today.AddDays(-1)
cnnOLEDB.ConnectionString = strConnectionString
cnnOLEDB.Open()
'Dim strUpdate As String
Try
Dim sqlQRY As String
sqlQRY = "Select * From Customers WHERE SupplierName = '" & SuppNameVariable.Text & "' AND SupplierFeedbackDate = '.... / .... / .....' AND DateAdded <'" & CDate(Yesterday) & "'"
Dim da As OleDbDataAdapter
Dim ds As DataSet = New DataSet
da = New OleDbDataAdapter(sqlQRY, cnnOLEDB)
Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(da)
da.Fill(ds, "Customers")
Alerting_Escalation_Tool.DataGridViewCustomer.DataSource = ds
Alerting_Escalation_Tool.DataGridViewCustomer.DataMember = "Customers"
Catch ex As OleDbException
MsgBox(ex.ToString)
End Try
cnnOLEDB.Close()
End Sub()
推荐答案
这篇关于需要在数据库中搜索标准是日期字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!