Incorrect Syntax Near % Sql Parameter In C#.NET and SQL Server
When writing sql statements in your business logic layer, you often want to append % which is a literal in your query. An example would be like this: string query = "Select * from Patient where LastName like '" + "@family" + " %'" ; However, this would give you an error, since the @family parameter is inside the tick marks that makes it a literal, but the % sign should be inside the tick marks. So, the correct sql syntax would be this way: string query = "Select * from Patient where LastName like (@family + '%')" ; Source: VBForums Link