SELECT e.Number, e.Type, a.Code
FROM EqNum e INNER JOIN AreaCd a
ON e.AreaId = a.AreaId
WHERE (@Number IS NULL OR e.Number = @Number)
AND (@Type IS NULL OR e.Type = @Type)
AND (@Code IS NULL OR a.Code = @Code)
Para aprender a usar parámetros con ADO.NET, haga clic aquí .
La configuración de parámetros se vería así:
command.Parameters["@Number"].Value = (string.IsNullOrEmpty(number) ? (object) DBNull.Value : number);