Hi there,
Your problem is rooted in the way URLs work. The ampersand character is used to separate query string variable. For example, if you look at this page, you'll see something like this:
http://p2p.wrox.com/post.asp?method=...2&FORUM_ID=212
The ampersand separates the querystring field TOPIC_ID from the FORUM_ID. In your case, you try to have something like this:
SomePage.aspx?CorpName=H & Wilsom
Basically, this gives you a querystring parameter of
CorpNamewith a value of H and a querystring parameter of
Wilsom without a value. So, when you execute the SELECT statement, you query for everything that starts with an H.
There are a few ways around this. Probably the easiest way is to avoid query strings. Is there a particular reason you're using a querysting? Can't you use a search field on the same page that displays the records?
If not, then you can escape the querystring using Server.UrlEncode. For example this:
Server.URLEncode("H & Wilson")
results in
H+%26+Wilson
When you pass this over the querystring, there's a fair chance your query will work.
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to:
Track 12 by
Live (Track 12 from the album:
Throwing Copper)
What's This?