在SQL LIKE子句中使用SqlParameter不起作用
我有以下代码: const string Sql = @"select distinct [name] from tblCustomers left outer join tblCustomerInfo on tblCustomers.Id = tblCustomerInfo.CustomerId where (tblCustomer.Name LIKE '%@SEARCH%' OR tblCustomerInfo.Info LIKE '%@SEARCH%');"; using (var command = new SqlCommand(Sql, Connection)) { command.Parameters.AddWithValue("@SEARCH", searchString); ... } 这行不通,我也尝试这样做: const string Sql = @"select distinct [name] from tblCustomers left outer …