473,763 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using LIKE %% with controlparamete r

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...

<SelectParamete rs>
<asp:ControlPar ameter ControlID="txtS earch" PropertyName="T ext"
DefaultValue="" Name="search" />
</SelectParameter s>

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 2770
hi,

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

"musosdev" <mu*******@comm unity.nospam>, iletisinde şunu yazdı,
news:E8******** *************** ***********@mic rosoft.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...

<SelectParamete rs>
<asp:ControlPar ameter ControlID="txtS earch" PropertyName="T ext"
DefaultValue="" Name="search" />
</SelectParameter s>

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*******@comm unity.nospam>, iletisinde şunu yazdı,
news:E8******** *************** ***********@mic rosoft.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...

<SelectParamete rs>
<asp:ControlPar ameter ControlID="txtS earch" PropertyName="T ext"
DefaultValue="" Name="search" />
</SelectParameter s>

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
1828
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. <-------------------------- Code Snippet ---------------------------> <asp:GridView ID="GridView1" Runat="server"
3
6044
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 "LabLocation_ID". With an existing lab, they then need to add the members for that lab. So, what I am trying to do is the following. With the FormView of the Lab open, the user will click a button to open a FormView (InsertMode) and add a new...
0
2996
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 need to add my select parameters programmatically. Here are my 2 ControlParameters are they were originally : <SelectParameters> <asp:ControlParameter Name="Month" ControlID="ddlMonth" PropertyName="SelectedValue" />
2
1402
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 that list. The problem I have is that the list box and the form are in different content placeholders, and I can't get them to work together. I have this code: <asp:Content ID="Content2" runat="server" ContentPlaceHolderID="SideContent">
1
2692
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" PropertyName="SelectedValue" Type="String" /> </UpdateParameters> Thanks
7
2889
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", "OE_HDR"."SLS_MAN_NO", "OE_HDR"."SLS_MAN_INITIALS", "OE_HDR"."ORD_DAT", "OE_HDR"."SHIP_DAT" FROM "OE_HDR" WHERE ("OE_HDR"."ORD_NO"='174310') I also have DropDownList1 working properly. For the WHERE portion of
0
2588
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 ID="SqlDataSource1" runat="server" ConnectionString="<% .......... %>" InsertCommand="INSERT INTO .......)"
2
2622
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 control 'ddlNewPropRoleID' in ControlParameter 'RoleID'. Thanks. David
1
1165
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" AutoGenerateColumns="False" OnSelectedIndexChanged="Search_GridView_SelectedIndexChanged" CellPadding="20" Width="720px" AllowPaging="True" OnPageIndexChanging="Search_GridView_PageIndexChanging" DataSourceID="SqlDataSource1"> ...
1
3099
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 am using a form page an code behing, and I have currently my ConnectionString within my form. Therefore http://www.mikesdotnetting.com/Article.aspx?ArticleID=54 was close but not exactly what I need at this point. So far I have done the following...
0
9563
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9998
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.