473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

using LIKE %% with controlparameter

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
Aug 14 '08 #1
2 2752
hi,

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

"musosdev" <mu*******@community.nospam>, iletisinde şunu yazdı,
news:E8**********************************@microsof t.com...
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
Aug 14 '08 #2
Tahir,

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

Cheers!
Dan

"Tahir" wrote:
hi,

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

"musosdev" <mu*******@community.nospam>, iletisinde şunu yazdı,
news:E8**********************************@microsof t.com...
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
Aug 14 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lee Moore | last post by:
I have the following code, which I thought should work. I get an error stating ... Could not find control 'GOAL_TEXT_CONTROL' in ControlParameter 'GOAL_TEXT'. Any help would be great. ...
3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
0
by: Mike P | last post by:
I am using a GridView with 3 SelectParameters 2 of which are ControlParameters, but the third of my SelectParameter values is derived through my code rather than a QueryString, Control etc, so I...
2
by: Dynamo | last post by:
Hi there, I have a curious problem I can't seem to solve. I have a list box that gets filled with data, the user selects an item in this list, then a form view displays the full details from...
1
by: Cas | last post by:
Hi, How to add a controlparameter in the code-behind that is the equivalent in the aspx file of: <UpdateParameters> <asp:ControlParameter ControlID="myID" Name="myname"...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
0
by: Bart | last post by:
Hi, i want to programmatically manipulate the property 'Name' of a ControlParameter inside a InsertParameters tag. This the aspx code: ------------------ <asp:SqlDataSource...
2
by: David C | last post by:
Is it possible to refer to a ControlID that is inside a FormView? If so, what is syntax? I tried to reference it just by the controlid and it created an exception with the message Could not find...
1
by: sweatha | last post by:
Hi I connected SQLDataSource in GridView by using coding <asp:GridView ID="Search_GridView" runat="server" Style="z-index: 100; left: 2px; position: absolute; top: 270px"...
1
by: Pipo Dyer | last post by:
Hello Everybody, I am Using @@IDENTITY from MS Access (YES-It is possible) using SqlDataSource -NO STORE PROC- in ASP.NET {VB CODE} to retrieve the ID of a inserted record. Please keep in mind I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.