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

Joel D Canfield joel at streamliine.com
Sun Sep 16 13:53:52 CDT 2007

> >    CONVERT(assettag,'System.String') like '%{0}%'
> well, if that works for you, then assettag must be a 
> user-defined sql server datatype

this is .NET 'helping' with the SQL - as far as I can tell, this is .NET
layered on top of SQL, not pure SQL. I suspect *this* CONVERT is a .NET
function thingy, and I *know* the {0} is a .NET placeholder for the bit
of text passed from the text field in the search form.

I'm trying to use the Visual Studio GUI for development on this project,
because I'll almost certainly get roped into helping the client (*very*
computer savvy, no programming experience) to do maintenance. The
FilterExpression and FilterParameters aren't composed simply and
directly as SQL queries, which is where I ran into problems.

Instead of simply writing a SQL query and running it, as I'm used to,
when .NET munges the query bits together, it's not allowing purely SQL
syntax (which may very well be my confusion.)

Anyway, what I've got seems to be returning the results I want, so I'm
sincerely hoping it's correct, and not some comedy of errors ;)


More information about the thelist mailing list