I am trying to add a parameter to my table adapter in my C# project. When I add the @ to the where clause visual studio gives me an error. Here is my SQL statement:
select PO.PO_Num,
PO.Supplier,
PO.DateOrdered,
PO.DateRequired,
PO.Terms,
PO.Freight,
PO.FOB,
POItems.PO_Num as Expr1,
POItems.Quantity,
POItems.Description,
POItems.Item,
POItems.Price,
POItems.KeyNum
from PO,
POItems
where PO.PO_Num = POItems.PO_Num
and (PO.PO_Num = @PO_Num)
Can someone please tell me what I am doing wrong? Thanks in advance for any help!
To fix the error I needed to change the where clause from this:
where PO.PO_Num = POItems.PO_Num and (PO.PO_Num = @PO_Num)
And add a question mark (?) in stead of the at symbol (@) like so:
where PO.PO_Num = POItems.PO_Num and (PO.PO_Num = ?)
After that I was able to execute the query, and Visual Studio 2010 didn't throw an error.