我意思是如果是空值怎么才能不影响查询结果,下面是完整语句(可以正常执行):
sql="select f.*, p.[Name] as ProcudtName, t.[Name] as FileInfoType, d.[Name] as DepartmentName from fileinfo as f left outer join Product as p on f.ProductID = p.ProductID left outer join FileType as t on f.FileTypeID = t.FileTypeID left outer join Department as d on f.DepartmentID = d.DepartmentID where f.Status = '0' and f.Confidential = '2' and ( p.ProductCode = '" &ProductCode& "'and f.[Name] = '" &FileName& "' and f.FileTypeID = '" &FileTypeID& "' and f.DepartmentID = '" &DepartmentID& "' and p.CustomerID = '" &CustomerID& "') order by f.[Name]"