Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching SQL mutliple feilds using designer 1

Status
Not open for further replies.

NerdTop72

Programmer
Mar 14, 2005
117
US
I am confused...

I am making an error list tool to consolidate fixes for computer issues for my job.

I am trying to make an asp.net page to search multiple fields.

I have a tblError
SoftwareID
ErrorDescription
EventID
ErrorCode

The problem is I want to be able to search 1 field, or all 4 at the same time. I added a sqladapter and bound my where clause to my controls textbox fields. The problem is, something has to be entered in every field for it to conduct a search. Is there a magic * to search everything regardless if that field is empty that I can throw in my default value field if nothing is entered?

Here is my select statement

SELECT * FROM [TBLError] WHERE (([EventID] = @EventID) AND ([SoftwareID] = @SoftwareID) AND ([ErrorDescription] LIKE '%' + @ErrorDescription + '%') AND ([ErrorCode] LIKE '%' + @ErrorCode + '%'))

I appologize in advance, I do not know if i should post in the sql forum.

Thanks

 
try changing AND to OR.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Now I have another issue with this scenario...

I have a search button to apply the search variables for text boxes and dropdownlists & textboxes.

upon clicking the search button...
Protected Sub btnSearch_Click
SqlSearchErrors.DataBind()
end sub

This does not update my Gridview with the results?

In the designer I have tested my query and it does give me results.

to test out my dropdownlist values I re did my sql statement to only bind to my dropdownlist. which displays my values in the gridview upon loading the page. not by the search button click event.

How do I invoke the bind for the text box values by using my button click control? I mean, what is the point of the designer bind fields if it will not take the textbox values upon a request? I know I am missing something simple here.

Shouldn't the designer know to bind with the text box controls automatically and update my gridview just like changing the selected item in the dropdownlist would update the gridview?

Thanks



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top