我有一條SQL語句,我試圖用它將一個vb.net程序連接到訪問數據庫。我正在使用日期/時間選擇器來提供日期。我已經四處搜尋,我對該聲明所做的各種更改沒有返回任何結果。對於什麼它的價值這個查詢訪問中工作正常:訪問兩個日期之間的SQL
SELECT * FROM tblcallLog
WHERE startDate Between #" & dspstart.text & "# AND #" & dtpend.text & "#"
確定這裏是整個點擊事件,每@ ajax81要求
輸入代碼在這裏
Private Sub btnDateUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDateUpdate.Click
grpT2DateRange.Visible = True
grpT2SingleStaff.Visible = True
grpT2Transfer.Visible = True
lblT2TotalCallsData.Visible = True
Dim strSDate As String = dtpStart.Text
Dim strEDate As String = dtpEnd.Text
'CountDate Variables
Dim strSQLCountDate As String = _
"SELECT * FROM tblcallLog WHERE startDate Between #" & dtpStart.Text & "# AND #" & dtpEnd.Text & "#"
Dim odaCallDate As New OleDb.OleDbDataAdapter(strSQLCountDate, strPath)
Dim datCallDateCount As New DataTable
Dim intDateCount As Integer
intDateCount = datCallDateCount.Rows.Count
lblT2TotalCallsData.Text = intDateCount.ToString
enter code here
嘗試使用參數化查詢,它可能會更好地工作,並避免sql注入漏洞。 – BlackICE
您向我們展示了什麼可行。你在做什麼不起作用?沒有返回任何結果的代碼片段是必要的,可以爲您提供任何有意義的幫助。 – mwolfe02