Groups > Asp .Net > Getting started with ASP.NET > Re: Search




Search

Search
Thu, 3 Apr 2008 12:04:21 +0000
Hi,

I have a page with a textbox and a button.

When you type something into the textbox and press the button, it moves you to a
page with whatever you typed in the box as a querystring.

On that page there is a gridview.

On the page load there is the code:         string valueshere =
Request.QueryString["Value"]; 

The gridviews SELECT statement is:

SELECT [A], [B], [C], [D], [E], [F], [G], [H], [I] FROM [Z] WHERE (([A] LIKE
'%valueshere%') OR ([J] LIKE '%valueshere%')) 

 

Can someone tell me why this gridview doesn't return anything from table [Z] ?
The string is definitely being passed onto the page (?Value=)


Thanks,

Jon
Post Reply
Re: Search
Thu, 3 Apr 2008 12:36:21 +0000
Hi

Check the value is present or no and check the value you sent from the textbox
page to the gridview page weather it comes or no ........
Post Reply
Re: Search
Thu, 3 Apr 2008 12:43:58 +0000
try this..

SELECT [A], [B], [C], [D], [E], [F], [G], [H], [I] FROM [Z] WHERE (([A] LIKE
'%"+ valueshere +"%') OR ([J] LIKE '%"+ valueshere +"%'))
Post Reply
Re: Search
Thu, 3 Apr 2008 16:07:54 +0000
Hi thanks for replies.

I tried WHERE (([A] LIKE '%"+ valueshere +"%') OR ([J] LIKE '%"+
valueshere +"%'))  but it still returned no rows...

Any other ideas? Is it right that I have the code in PageLoad - should that code
be somewhere else?
Post Reply
Re: Search
Thu, 3 Apr 2008 19:26:41 +0000
Just a shot in the dark.

 Do you databind after you run the SQL query?

The query might be working but not displaying.
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact