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

Ken Schaefer Ken at adOpenStatic.com
Mon Sep 17 02:07:25 CDT 2007


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

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). Typically you'd use it like so:

intResult = System.Convert.ToInt32(someNumber)

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


-----Original Message-----
From: thelist-bounces at lists.evolt.org [mailto:thelist-bounces at lists.evolt.org] On Behalf Of Joel D Canfield
Sent: Monday, 17 September 2007 4:54 AM
To: thelist at lists.evolt.org
Subject: Re: [thelist] ASP.NET 2.0 and MSSQL - using 'like' with Int32

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