Home > Database > Mysql Tutorial > 数据库中模糊查询

数据库中模糊查询

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:16:59
Original
2012 people have browsed it

模糊查询 数据库中 模糊查询,用 * 或者 ? 代替单词中相应的字符,来 模糊查询."*"匹配字符在数据库中可以用"%%"代替;"?"批判字符在数据库中可以用"_"代替. 实例代码: 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);

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template