Home > Database > Mysql Tutorial > Like的一个小技巧 %%

Like的一个小技巧 %%

WBOY
Release: 2016-06-07 15:06:01
Original
1310 people have browsed it

(1)SelectCommand="SELECT [Admin], [AdPassword], [Purview] FROM [_Admin] where Admin like @Admin 注意改成like,并且不加%%号 (2)查询时用如下语句,注意写法. SqlDataSource1.SelectParameters["Admin"].DefaultValue = "%" + TextBox1.Text + "%"; Grid

(1)SelectCommand="SELECT [Admin], [AdPassword], [Purview] FROM [_Admin] where Admin like @Admin
注意改成like,并且不加%%号

(2)查询时用如下语句,注意写法.

  SqlDataSource1.SelectParameters["Admin"].DefaultValue = "%" + TextBox1.Text + "%";
        GridView1.DataBind();

--------------
最后说明一下:这就是微软的一个示例程序,这种方法同时适用于存贮过程,三层强类型数据集.


(1)如果不输入任何东西,就返回整个表中的数据.
(2)如果输入东西,那么按输入的东西进行查询. 

Related labels:
source:php.cn
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