Note: I tried posting this on Stack Overflow but didn't get any good bites. I'm still researching this but wanted to see if any db czars can assist here.
I'm in the process of trying to troubleshoot some SQL 2012 code in an ASP/C# gridview search that I rolled myself. I have a search box that searches on specific fields but the twist here is that I only want results after a certain row.
In this database I have a sequence command that autogenerates a number in a column called 'record_number' for every entry in this table and only want results after record #500. The entries are created manually via a different page.
Right now my search code is as follows:
"SelectCommand="SELECT [record_number], [column_a], [column_b], [column_c], [column_d], [column_e], [column_f], [column_g], [column_h], [column_i], [column_j] FROM [schema].[table_name] WHERE record_number >= 500 AND ([column_a] LIKE '%' + @column_a + '%') OR ([column_c] LIKE '%' + @column_c + '%') OR ([column_e] LIKE '%' + @column_e + '%') OR ([column_g] LIKE '%' + @column_g + '%') OR ([column_h] LIKE '%' + @column_h + '%') OR ([column_j] LIKE '%' + @column_j + '%')"
I can post my SelectParameters if needed or anything else. The challenge I'm facing is when I run a search for just the letter 'c' leveraging this code, the results that post have a record_number less AND greater than than 500. At this point I'm spinning my wheels as I'm not seeing where the problem lies.
If more information is needed by the masses, please let me know.
Forgot this part - I've tried moving around the commands and consolidating the commands but no go.