I have a view in my DB and the view has a row I am trying to search for. I've tested it in sql server and it returned the correct result. However when I try it with parameters from vb it won't return anything. The Sql code that I get a query to return a correct result looks like
SELECT *
FROM
(SELECT
ROW_NUMBER() OVER (ORDER BY groupID DESC) AS Row, *
FROM
SchedulingGroup_VIEW
WHERE
(scheduled = 1)
AND ((building LIKE '%dunn%') OR (room LIKE '%dunn%')
OR (requestBy LIKE '%dunn%') OR (requestFor LIKE '%dunn%')
OR (groupID LIKE '%dunn%') OR (description LIKE '%dunn%'))
AND (NOT EXISTS (SELECT gID FROM facilitiesForm
WHERE facilitiesForm.gID <> gID))) AS TMP
WHERE
(Row BETWEEN 0 AND 100)
The SQL with parameter looks like
SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY groupID DESC) AS Row, *
FROM schedulingGroup_VIEW
WHERE (scheduled = 1) AND
( (building LIKE '%' + @search + '%')
OR (room LIKE '%' + @search + '%')
OR (requestBy LIKE '%' + @search + '%')
OR (requestFor LIKE '%' + @search + '%')
OR (groupID LIKE '%' + @search + '%')
OR (description LIKE '%' + @search + '%'))
AND
(NOT EXISTS (SELECT gID FROM facilitiesForm
WHERE facilitiesForm.gID <> gID))) AS TMP WHERE (Row BETWEEN 0 AND 100)
sqlComm.Parameters.AddWithValue("@search", info.search)
with info.search = "dunn".
The sql query returns the appropriate row but the vb.net with parameters returns nothing.