I have a search form in which one can search per many fields (textboxes). I have noticed that if I include a field that has a bunch of NULLs in its values of the table, then the query fails, i.e. doesn't return those values.
The where clause of my SQL statement is as follows:
'"AND dbo.Invoice.ThisNum LIKE '%" & txtThisNum.Text & "&' " & _
...
[/blue]
If nothing is typed into the txtThisNumber textbox I would like it to return anyways, kinda like an ALL return.
It's like when no one types anything into the search criteria of the form, all rows of the database table should be returned. But this behavior is not present here b/c it only returns the rows that have dbo.Invoice.ThisNum NOT NULL, i.e. with a value in them.
I know I should use parameterized queries, but can someone help me with the above logic/syntax?
The where clause of my SQL statement is as follows:
'"AND dbo.Invoice.ThisNum LIKE '%" & txtThisNum.Text & "&' " & _
...
[/blue]
If nothing is typed into the txtThisNumber textbox I would like it to return anyways, kinda like an ALL return.
It's like when no one types anything into the search criteria of the form, all rows of the database table should be returned. But this behavior is not present here b/c it only returns the rows that have dbo.Invoice.ThisNum NOT NULL, i.e. with a value in them.
I know I should use parameterized queries, but can someone help me with the above logic/syntax?