ACCESS模糊查詢

2022-03-08 03:58:11 字數 551 閱讀 9771

access模糊查詢出現的問題,開發中需要注意!

在sql server中模糊查詢通常是這樣的select * from articletable where authorname like '%關鍵字%'

但是access的萬用字元和sql server的萬用字元不一樣。

access資料庫內測試時的萬用字元為:

*  與任何個數的字元匹配

?  與任何單個字母的字元匹配

在sql server中的萬用字元為:

% 與任何個數的字元匹配

_與單個字元匹配

正確寫法應是:

在c#裡寫應寫成 select * from table where name like '%關鍵字%'  

select * from table where name like '_關鍵字_'  

access內測試語句應寫成 : select * from table where name like '*關鍵字*'  

select * from table where name like '?關鍵字?'

原文:

ACCESS模糊查詢

原文 access模糊查詢出現的問題,開發中需要注意 在sql server中模糊查詢通常是這樣的select from articletable where authorname like jacky 但是在access中用這條語句執行的時候竟然發現查不出結果,怎麼可能呢?後來查了下資料,發現問題...

ACCESS模糊查詢

access模糊查詢出現的問題,開發中需要注意 在sql server中模糊查詢通常是這樣的select from articletable where authorname like jacky 但是在access中用這條語句執行的時候竟然發現查不出結果,怎麼可能呢?後來查了下資料,發現問題如下 ...

Access 引數 模糊 查詢

string sql select from tbproduct where classid in ids and productname like productname order by id desc oledbparameter sps new oledbparameter 1 sps 0 ...