using LIKE %% with controlparameter

  • Thread starter Thread starter musosdev
  • Start date Start date
M

musosdev

Hi

I have a GridView using an SQLDataSource on my aspx form.

I've got the control parameter in the SQL as follows...

... WHERE ([ProjectName] LIKE @search)

and my control parameter is declared as follows...

<SelectParameters>
<asp:ControlParameter ControlID="txtSearch" PropertyName="Text"
DefaultValue="" Name="search" />
</SelectParameters>

However, I need to be have my SQL be have LIKE % % around my control
parameter. Kinda like...

... WHERE ([ProjectName] LIKE %@search%)

But I can't get any variation on this to work. How can I make sure that my
query returns any row where ProjectName containts whatever is in @search ?!

Thanks,


Dan
 
Tahir,

That worked great, thanks. Probably the only variation I didn't try!

Cheers!


Dan

Tahir said:
hi,

did you try this?
WHERE ([ProjectName] LIKE '%' + @search + '%')



iletisinde şunu yazdı said:
Hi

I have a GridView using an SQLDataSource on my aspx form.

I've got the control parameter in the SQL as follows...

.. WHERE ([ProjectName] LIKE @search)

and my control parameter is declared as follows...

<SelectParameters>
<asp:ControlParameter ControlID="txtSearch" PropertyName="Text"
DefaultValue="" Name="search" />
</SelectParameters>

However, I need to be have my SQL be have LIKE % % around my control
parameter. Kinda like...

.. WHERE ([ProjectName] LIKE %@search%)

But I can't get any variation on this to work. How can I make sure that my
query returns any row where ProjectName containts whatever is in @search
?!

Thanks,


Dan
 
Back
Top