wildcard '%' acting like wildcard '_' in .net aspx page
- From: Gordon.E.Anderson@xxxxxxxxx
- Date: 27 Mar 2007 12:53:36 -0700
short description:
i've got a .net web site set up using a tableadapter attached to a sql
server table - returning results only, no update of data. i've got a
query (qry code below) set up to search and return based on
description. i've got a textbox on an aspx page for input of the
search term (@DESC). when i put in T% into the textbox on the aspx
page i get 0 results - if i put in T% for @DESC in the query builder
and preview the info i get 775 results (all items starting with 'T').
here's what i consider to be the REALLY strange part.... if i put T%%%
in the web page textbox i get 4 results - 3 with descriptions that =
'TOOL' and 1 that has a description = 'TENT'. i get the exact same
results if i put in T___ (T + 3 underscores). if i keep putting on
more %'s, the qry treats them like _'s and i get more and more results
with each % i put on the query.
unless i'm confused - which i often am - the '_' is a 1 char wildcard
and the '%' is a multiple char wildcard - this is the case in the
query builder's preview but not when the info is passed from the aspx
page.....
in the tableadapter query configuration wizard, i've got the following
query:
SELECT StoreBranchNo, SKU, Active, CategoryCode,
PublicDescription, Mfg, Model, Type, SerialNo, NewItem, UniqueItem,
Price, SalePrice, Cost, QtyOnHand,
QtyAvailable, QtyOnLayaway, QtyReOrderPoint,
QtySuggestedToOrder, TotQtySold, StatusDate, CreationDate, ItemSize,
Weight, WeightUnits, Color,
Karat, Carat, Finish, Caliber, ItemAction,
BarrelCount, OriginalEmployee, RockBottom, Notes, Picture,
UpdateTimeStamp
FROM tbl_LARS_Inventory
WHERE (PublicDescription LIKE @DESC) OR
(PublicDescription = @DESC)
the 'PublicDescription = @DESC' is in there to include exact matches
also. i've tried this without the '= @DESC' and i get the same
results.
i'm so frustrated by this behavior, i'm really hoping someone can
stroll by this board and say "oh, yea, you idiot, THIS is what is
wrong." and have it be an easy fix. if anyone needs more information
in order to help, please let me know. i didn't want to post too much
info but i'm afraid i'm probably posting too little.
thanks in advance
gordon
.
- Follow-Ups:
- Re: wildcard '%' acting like wildcard '_' in .net aspx page
- From: Bob Butler
- Re: wildcard '%' acting like wildcard '_' in .net aspx page
- Prev by Date: RE: Getting a "working" VB6/SQL2000 application functional in Vist
- Next by Date: Transfer an array of data to a range on a work***
- Previous by thread: Re: Macro security warning
- Next by thread: Re: wildcard '%' acting like wildcard '_' in .net aspx page
- Index(es):