简体   繁体   English

SQL where where子句是什么意思?

[英]SQL what does & in where clause mean?

Is this code right: 这段代码是对的:

"SELECT * FROM dataTable WHERE Datee Between '#" & textStartDate.Text & "# AND #" & textEndDate.Text & "#'"      

What does that & mean and that # can someone tell me please I am using vb and acess 那是什么意思和#有人可以告诉我,我正在使用vb和acess

The ampersand "&" is used for concatenation. &符“&”用于连接。

Before 之前

"SELECT * FROM dataTable WHERE Datee Between '#" & textStartDate.Text & "# AND #" & textEndDate.Text & "#'"  

After

"SELECT * FROM dataTable WHERE Datee Between '#" & textStartDate.Text & "#' AND  '#" & textEndDate.Text & "#'" 

The between statement was missing "'" quotes to enclose the date values. 之间的语句缺少“'”引号来包含日期值。

Edit 编辑

How to add a wildcard to a non-date sql query. 如何将通配符添加到非日期sql查询。 This code has wild cards on both side of the variable. 此代码在变量的两侧都有通配符。

...WHERE SomeField like  '*" & textWeAreSearchingFor & "*'"

Here are other examples on how to query date datetype. 以下是有关如何查询date datetype的其他示例。

...WHERE Datee >= '#" & textStartDate.Text & "#'"

OR 要么

...WHERE Datee < '#" & textStartDate.Text & "#'"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM