TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Software World > Programming

Notices

SQL question

Programming


Reply
 
Thread Tools Display Modes
Old 01-09-2009, 09:28 AM   #1
Newbie
 
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 tmccubb is an unknown quantity at this point


OS: Windows XP


SQL question

I need some help. I have an asp .net page that has 6 text boxes that allow people to search. They can enter data in one or more of the text boxes for the search. The problem is that the database has nulls and the search does not retrieve those records with null values. My sql code is as follows:

Select FieldA, FieldB, FieldC, FieldD, FieldE, FieldF
From TableA
Where FieldA Like '%' + @FieldA + '%' And FieldB Like '%' + @FieldB + '%' AND FieldC Like '%' + @FieldC + '%' AND FieldD Like '%' + @FieldD + '%' AND FieldE Like '%' + @FieldE + '%' AND FieldF Like '%' + @FieldF + '%'

The @fields are then assigned to the text box values and assigned to '%%' if blank.

Any suggestions would be appreciated!
tmccubb is offline   Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 02:07 PM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional