473,385 Members | 1,958 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,385 software developers and data experts.

< or > in my SqlDataSource's SelectCommand

Hello,

Hopefully this is a simple question. I'm using an ASP.NET GridView. I'm setting the SQL in my SelectCommand's SqlDataSource. I have a need to qualify a field with a "<" symbol, but ASP.NET doesn't like it because it thinks I'm trying to insert an html or ASP tag. So how does one get "<" or ">" in the query without the code interpretting it as a tag?

Robert

[UPDATE]
Nevermind. I solved my own problem. Use "&lt;" and "&gt;" rather than "<" and ">". I tried to delete this thread before anyone answered, but I don't have that option. Is it only a moderator function?

Robert
Jun 5 '08 #1
3 1552
DrBunchman
979 Expert 512MB
Hi Robert,

Can you just post a sample of the relevant part or perhaps just a small example of what you're trying to do?

Dr B
Jun 5 '08 #2
Plater
7,872 Expert 4TB
It's ok that you found the answer for yourself. the question will stay here and perhaps someone else solve their problem.
With that in mind, perhaps you could post a little bit of code that explains what you were doing with, and the fix that you applied?
Jun 5 '08 #3
Okay.

Basically, in my GridView, I am using an SqlDataSource to populate the view and the SqlDataSource had the SelectCommand set something like this (with much simplified SQL):

START EXAMPLE:
SelectCommand="select field1, field2 from my table where field1 < 10"
END EXAMPLE:

This was failing to compile because the "<" symbol in the ASP was being interpreted as an html or ASP tag (i.e. <p>). I solved my problem by using "&lt;" instead. The code now appears like:

START EXAMPLE:
SelectCommand="select field1, field2 from my table where field1 &lt; 10"
END EXAMPLE:

And it works as desired.

Thanks!

Robert
PS. I tried using the code brackets on the above that this message board recommends ([CODE*]), but it was converting the "&lt;" symbol to "<".
Jun 5 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: OutlookNewbieDev | last post by:
Hello, I'm new to ASP.NET but have done quite a bit of classic ASP. I need to drill down to another page from the DataGrid using a record's ID. In classic ASP, this was quite easy but I can't...
3
by: Daniel R. H. | last post by:
Hi, I'm having problems to get the value of a Querystring into the SelectCommand of a SQLDataSource, here's my code: ---------------------------------------------- <asp:SqlDataSource...
4
by: googlegroup | last post by:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionString:SalesDBConnectionString %>" SelectCommand="<%=strSQL%>" /> In ASP.NET , how do you assign a dynamic...
0
by: Radu | last post by:
Hi. On the first page of my website the user selects one document which can be in either English or French. I store that choice in a class, and I can extract it with:...
1
by: John Kotuby | last post by:
Hello again... I have tried using the SQLDatsource control as part of a user control that just conatins a Repeater and the SQLDatasource control which is designated as the Datsource for the...
0
by: danielhamd | last post by:
I am converting a website that uses an Access Database to SQL Server. On one particular SqlDataSource I am having a lot of trouble. Here is the original: <asp:SqlDataSource ID="SqlDataSource1"...
2
by: Julien Sobrier | last post by:
Hello, I have 2 SqlDataSource on the same page that retrieve the same column names: <asp:SqlDataSource ID="SqlStructure" runat="server" SelectCommand="SELECT a, b FROM c WHERE d = 0 /> ...
3
by: Homer J. Simpson | last post by:
I have the following stored procedure: ALTER PROCEDURE . AS BEGIN SET NOCOUNT ON; SELECT COUNT(*) FROM QUICKNOTES END ....and the following data source in my .aspx file:
4
by: justice750 | last post by:
Hi All, I am using a FormView control. The allows me to update records in the database. However, when a database field is null I can not update the field on the form. It works fine when the field...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.