I know some basic SQL, but beyond adding some AND and WHERE conditions . . I get lost.
I have a SQL Datasource in asp.net that I want to bind to a datagrid. This usually is a snap. But I have multiple text boxes on the form that I want to use in the WHERE conditions. The SQLdata wizard allows you to point to the control and pick it in your WHERE statement. But here is where I need help.
I want to do a Select * Where field1 = textbox1
But only if the textbox1 is not blank. If it is blank, it will skew my search results. How do I do this?
I don't really want to manually bind my datagrid because then it is a headache (and beyond my expertise) to get the edit, sort, etc working.
I can see the SQL that the datasource wizard generates, I just need to know how to edit that sql so that I can make it SELECT WHERE field1 = textbox1 . . . only when textbox one has data in it . . otherwise, don't use it in the search criteria.