Heim >Datenbank >MySQL-Tutorial >数据库中模糊查询

数据库中模糊查询

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:16:592027Durchsuche

模糊查询 数据库中 模糊查询,用 * 或者 ? 代替单词中相应的字符,来 模糊查询."*"匹配字符在数据库中可以用"%%"代替;"?"批判字符在数据库中可以用"_"代替. 实例代码: CString strFind = ""; m_Rich.GetWindowText(strFind); strFind.Replace("*", "%%"); strF

       模糊查询

     数据库中模糊查询,用“*”或者“?”代替单词中相应的字符,来模糊查询."*"匹配字符在数据库中可以用"%%"代替;"?"批判字符在数据库中可以用"_"代替.

实例代码:

 CString strFind = "";
 m_Rich.GetWindowText(strFind);
 strFind.Replace("*", "%%");
 strFind.Replace("?", "_");
  CString strSQL = "";
 strSQL.Format("select a.keycode as keycode,a.codeno as keycodeno,b.codevalue as codevalue,b.codeno as codeno from keycount as a,codevalue as b where a.keycode like '%s' and a.relaxno=b.ID order by a.keycode,a.id ",strFind);
BOOL bExcute = ExcuteDBSQL(strSQL);

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn