Dim cmdSelect As New System.Data.SqlClient.SqlCommand("SELECT [counts] FROM [a1_holds] WHERE (dates ='" & TextBox1.Text & "' BETWEEN from_date AND to_date) AND service ='" & lab5.Text & "' ORDER BY [id] ASC", SQLData)
错误:BETWEEN附近的语法不正确
答案 0 :(得分:2)
Dim cmdSelect As New System.Data.SqlClient.SqlCommand("SELECT [counts] FROM [a1_holds] WHERE ('" & TextBox1.Text & "' BETWEEN from_date AND to_date) AND service ='" & lab5.Text & "' ORDER BY [id] ASC", SQLData)
答案 1 :(得分:1)
WHERE (dates = '...' BETWEEN ... AND ...)
是语法错误。可以是:('...' BETWEEN ... AND ...)
或(dates = '...')