troubleshooting Question

SQL Statement in ASPX page containing a greater than condition is confused with an HTML Tag.

Avatar of Dovberman
DovbermanFlag for United States of America asked on
ASP.NETSQL
3 Comments2 Solutions592 ViewsLast Modified:
SQL Statement in an  ASPX page containing a greater than condition is confused with an HTML Tag.

Works in SQL Server management studio

SELECT TOP 1 Symbol.SecName,Symbol.SymbolName,  
            TrendGroup.SymbolID  
            FROM  Market INNER JOIN  
            Symbol ON Market.MarketID = Symbol.MarketID INNER JOIN  
            TrendGroup ON Symbol.SymbolID = TrendGroup.SymbolID
            WHERE Symbol.Active=1 AND Symbol.MarketID=1
            AND TGStartDate > '06/28/2007'
            ORDER BY TGStartDate DESC

Fails in ASPX SelectCommand

 <asp:SqlDataSource ID="dscPickToWatch" runat="server"
        ConnectionString="MyConnectionString"
        ProviderName="System.Data.SqlClient"
          SelectCommand="SELECT TOP 1 Symbol.SecName,Symbol.SymbolName,  
            TrendGroup.SymbolID  
            FROM  Market INNER JOIN  
            Symbol ON Market.MarketID = Symbol.MarketID INNER JOIN  
            TrendGroup ON Symbol.SymbolID = TrendGroup.SymbolID
            WHERE Symbol.Active=1 AND Symbol.MarketID=1
            AND TGStartDate > '06/28/2007'
            ORDER BY TGStartDate DESC " >
    </asp:SqlDataSource>

 TGStartDate = '06/28/2007' Works.
I believe the ">" sign is interpreted as an HTML tag.
ASKER CERTIFIED SOLUTION
renjurdevan

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros