Dim rawTables = From tables In dq.SystemObjects _
Where (Tables.Type = "U" And tables.Name <> "sysdiagrams") _
Select Name, Id
...the query I get is...
exec sp_executesql N'SELECT [t0].[id], [t0].[name]
FROM [sysobjects] AS [t0]
WHERE (
(CASE
WHEN [t0].[type] = @p0 THEN 1
ELSE 0
END)) & (
(CASE
WHEN [t0].[name] <> @p1 THEN 1
ELSE 0
END))',N'@p0 nvarchar(1),@p1 nvarchar(11)',@p0=N'U',@p1=N'sysdiagrams'
...and the error message is...
An expression of non-boolean type specified in a context where a condition is expected, near 'and'.
The query I am expecting is...
exec sp_executesql N'SELECT [t0].[id], [t0].[name]
FROM [sysobjects] AS [t0]
WHERE ([t0].[type] = @p0) AND ([t0].[name] <> @p1)',N'@p0 nvarchar(1),@p1 nvarchar(11)',@p0=N'U',@p1=N'sysdiagrams'

Cannot use AND in the where clause
ShivaGeorge
Theron