[thelist] ASP.NET 2.0 and MSSQL - using 'like' with Int32

Joel D Canfield joel at streamliine.com
Mon Sep 17 08:32:58 CDT 2007


> Can you provide a greater code snippet please (and also the 
> SQL Server version you are using)?

<asp:SqlDataSource 
    ID="srcDIDs" 
    runat="server" 
    ConnectionString="<%$ ConnectionStrings:cnxHelm %>"
    FilterExpression="CONVERT(did,'System.String') like '%{0}%'" 
    ProviderName="System.Data.SqlClient"
    SelectCommand="select did from dids">
    <FilterParameters>
        <asp:ControlParameter 
            ControlID="SearchTerm" 
            Name="did" 
            PropertyName="Text" />
    </FilterParameters>
</asp:SqlDataSource>

> Either CONVERT() is being called inside SQL Server (in which 
> case it must use the syntax provided by Rudy), or it is being 
> called inside .NET (Convert is a class in the System 
> namespace).

Well, it's SQL as Visual Studio has written it for me. I couldn't tell
you which of the above that means, only that, as it's written, it
returns the expected results.

> but perhaps it has an overloaded signature that allows you to 
> use the way you are using it.

If that means *I've* set something up to allow this, I assure you I
haven't ;) If it's important for me to know what that means, please
explain it, 'cause I don't have a clue what an 'overloaded signature'
is.

Thanks, Ken.

joel



More information about the thelist mailing list