Hi
I have been running some tests agains the NW db. To my project I added a typed view based on the 'Alphabetical list of products' view. I tried running it it from code (just the 'Fill' method - no sorting, filtering) & it blew on me in the 'GetMultiAsDataTable' in the TypedListDAO class. I took a look at the command text and here what was generated:
"SELECT [dbo].[Alphabetical list of products].[ProductID] AS [ProductId],[dbo].[Alphabetical list of products].[ProductName],[dbo].[Alphabetical list of products].[SupplierID] AS [SupplierId],[dbo].[Alphabetical list of products].[CategoryID] AS [CategoryId],[dbo].[Alphabetical list of products].[QuantityPerUnit],[dbo].[Alphabetical list of products].[UnitPrice],[dbo].[Alphabetical list of products].[UnitsInStock],[dbo].[Alphabetical list of products].[UnitsOnOrder],[dbo].[Alphabetical list of products].[ReorderLevel],[dbo].[Alphabetical list of products].[Discontinued],[dbo].[Alphabetical list of products].[CategoryName] FROM [dbo].[Alphabetical list of products]"
I plopped this SQL over into a new view in SQL Server, tried to run it and got a "Invalid nane 'CatagoryName'" error
If you adjust the generated code to this, and paste into SQL view it works just fine
"SELECT [dbo].[Alphabetical list of products].[ProductID] AS [ProductId],[dbo].[Alphabetical list of products].[ProductName],[dbo].[Alphabetical list of products].[SupplierID] AS [SupplierId],[dbo].[Alphabetical list of products].[CategoryID] AS [CategoryId],[dbo].[Alphabetical list of products].[QuantityPerUnit],[dbo].[Alphabetical list of products].[UnitPrice],[dbo].[Alphabetical list of products].[UnitsInStock],[dbo].[Alphabetical list of products].[UnitsOnOrder],[dbo].[Alphabetical list of products].[ReorderLevel],[dbo].[Alphabetical list of products].[Discontinued],[dbo].[Alphabetical list of products].[Expr1] FROM [dbo].[Alphabetical list of products]"
This seems to be because the SQL in the 'Alphabetical list of products' view declares CustomerName as Expr1:
SELECT dbo.Products.*, dbo.Categories.CategoryName AS Expr1
FROM dbo.Categories INNER JOIN
dbo.Products ON dbo.Categories.CategoryID = dbo.Products.CategoryID
WHERE (dbo.Products.Discontinued = 0)
The LLgen doesn't seem to pick this up...
Steve