Parameterized Queries
Home :: ASP.NET :: Parameterized Query Class
Create complex parameterized queries with a couple of lines of code!
Parameterized queries are great - mainly because they cannot be script injection attacked.
But using parameterized queries has always been difficult. This class wraps up the required functionality in a couple of lines of code to...
-
search most data types in different ways e.g. for string searches you can specify whether you want to match a whole string, any part of a string, a whole word, just the first part of a word, comma delimited strings, or even check plurals too!
-
You can get a 'fully loaded' datareader from the result set with one line of code!
-
Specify AND/OR/AND NOT etc. singly or in grouped clauses and ORDER BY
-
extensive manual support to manipulate the SQL string for those quirky requirements
-
Lookups i.e. return a value (even specify the expected return value). You can get a count of the number of records that will be returned
-
You can even UPDATE records!
-
An easy to call debug function is included
-
You can retrieve the raw SQL, an SqlCommand, or just the WHERE clause
-
you can specify the exact fields to return
-
IDisposable Support included
-
Integrates with my ParameterizedQuery.PagedTable object to get specified pages of records
Sample Code
'instantiate
the ParameterizedQuery (specifying 'Customers' as the table we are
querying)
Dim
pq As
New
ParameterizedQuery("Customers")
'search
the email field for customers with a btinternet email
pq.AddParameter("Email",
"btinternet",
ParameterizedQuery.ParamType.MatchWholeString)
'specify
an ORDER BY - note the case is insensitive -
pq.OrderBy
= "CustomerID
DESC"
Getting Started
Getting started is easy...
The rest of this page is hidden, you must be a member to view itTo become a member and get immediate access to the course please join here Free!
Next >> Search parameters
|