You need to write the Query this way.
DECLARE @ContactName VARCHAR(20)
SET @ContactName = 'maria'
SELECT customers.CustomerId
,ContactName
,OrderId
FROM Customers customers INNER JOIN Orders orders ON Orders.CustomerId = customers.CustomerId
WHERE ContactName LIKE @ContactName + '%'
Refer this link to download the Northwind database
Install Microsoft Northwind and Pubs Sample databases in SQL Server Management Studio
your C# query will be
string strQuery = "SELECT customers.CustomerId ,ContactName ,OrderId FROM Customers customers INNER JOIN Orders orders ON Orders.CustomerId = customers.CustomerId WHERE ContactName LIKE @ContactName + '%'";
Use this link to know how to use parameterized query