SQL语句一样不会返回一个通配符输出asp.net C# [英] SQL Like statement not return a wildcard output asp.net c#
问题描述
我的这些SQL语句来根据用户输入输出的工作领域。
i have these sql statement to output job field based on user input.
SELECT jf.name, j.jname, c.cname, cj.url
FROM company_has_job cj
INNER JOIN job j ON j.id = cj.job_id
INNER JOIN company c ON c.id = cj.company_id
INNER JOIN jobfield_has_job jhj ON jhj.job_id = j.id
INNER JOIN jobfield jf ON jf.id = jhj.jobfield_id
WHERE jf.name LIKE '%' + @InputJob + '%'
例如,当用户输入查询编程,系统将输出在database.but定义的所有程序员的工作,系统不会显示任何结果,如果我输入计划在搜索框中。这是我的控制参数:
for example when user input query "Programmer", the system will output all programmer job defined in the database.but the system does not show any result if i enter "Program" in the search box. This is my control parameter:
<SelectParameters>
<asp:ControlParameter ControlID="TextBox4" Name="InputExpertise"
PropertyName="Text"/>
</SelectParameters>
你能告诉我哪里做错了?你的帮助是非常AP preciated。
can you tell me where i did wrong? your help is much appreciated.
推荐答案
我不知道这是否只是一个错字,但它不应该是
I am not sure if this is just a typo, but shouldn't it be
WHERE jf.name LIKE '''%' + @InputJob + '%'''
请注意,我做了这样的code将最终为 LIKE'%程序%
,而它看起来像它最终会为 LIKE%程序%
目前
Notice that I made it so that the code will end up as LIKE '%Program%'
, whereas it looks like it will end up as LIKE %Program%
currently.
这篇关于SQL语句一样不会返回一个通配符输出asp.net C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!