Access模糊查询

2016-02-19 13:31 4 1 收藏

下面是个超简单的Access模糊查询教程,图老师小编精心挑选推荐,大家行行好,多给几个赞吧,小编吐血跪求~

【 tulaoshi.com - 编程语言 】

在近日的写Web程序时用到了Access的模糊查询,在Acces里写代码怎么也找不到记录,后来才起来原来Acess和SqlServer的模糊查询是有特别的

条件:查找表A 的Name字段中包括 "B" 的记当

在Access里的代码:

1 Select * from a where name like '*b*'Sql Server查询分析器的代码

Select * from a where name like '%b%'这时你会发现Access里可以找到相关的记录,但把'*'必成'%'就找不到了,原因是Access的模糊查询是'?','*'

和Sql server不一样

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/bianchengyuyan/)

以上只是在数据库中的代码,如果要写在程序里可就不能用.'*'了,还是要用'%'

程序:

strSql="select * from a where name like '%b%'"所以如果有朋友和我一样喜欢先在数据库中代码测试,那可就要注意了!!

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/bianchengyuyan/)

来源:https://www.tulaoshi.com/n/20160219/1604529.html

延伸阅读
今天用time Like '2008-06-01%'语句来查询该天的所有数据,被提示语句错误。查了一下才发现该模糊查询只能用于String类型的字段。 自己也查阅了一些资料。关于时间的模糊查询有以下三种方法: 1.Convert转成String,在用Like查询。 select * from table1 where convert(varchar,date,120) like '2006-04-01%' 2.Between select * from table...
标签: Web开发
以下为引用的内容: html head title不刷新页面查询的方法/title meta http-equiv="Content-Type" content="text/html; charset=gb2312" /head script language="javascript" !--初始化,将数据岛中数据装入列表框中-- function loadinsel() { var employeeid,employeelastname; //分别存放雇员ID和雇员名字 root=document....
标签: ASP
  <html <head <title不刷新页面查询的方法</title <meta http-equiv="Content-Type" content="text/html; charset=gb2312" </head <script language="javascript" <!--初始化,将数据岛中数据装入列表框中--  function loadinsel()  {    var employeeid,employeelastname; ...
标签: Web开发
html head title不刷新页面查询的方法/title meta http-equiv="Content-Type" content="text/html; charset=gb2312" /head script language="javascript" !--初始化,将数据岛中数据装入列表框中--  function loadinsel()  {    var employeeid,employeelastname; //分别...
标签: ASP
  if bh="" then    sql="select * from sl where bh like '%"&ss&"%'"   else bh=clng(bh) sql="select * from sl where bh=" & bh & " " end if   if nam<"" then   sql=sql&" and nam like '...

经验教程

173

收藏

62
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部