Reputation: 619
I have to build a custom report that takes the orderlines for each order with the client's name,address and username on the report.
When I make a simple query like:
SELECT FilteredSalesOrder.*, FilteredAccount.*
FROM FilteredSalesOrder INNER JOIN FilteredAccount
ON FilteredSalesOrder.customerid = FilteredAccount.accountid
I retrieve data but only for a single line. When there are more, the preview shows nothing. which is not that big of a problem because I only need it for 1 order at a time.
So for my OrderReport I need all the OrderLines for each order. The report is printed out per Order not for multiple orders at the same time.
It will look something like this:
I just joined 5 tables from which I need data in my Order Report.
SELECT FilteredSalesOrder.*, FilteredAccount.*, FilteredSalesOrderDetail.*, FilteredSystemUser.*, FilteredProduct.*
FROM ((((FilteredSalesOrder INNER JOIN FilteredAccount
ON FilteredSalesOrder.customerid = FilteredAccount.accountid) INNER JOIN FilteredSalesOrderDetail
ON FilteredSalesOrderDetail.salesorderid = FilteredSalesOrder.salesorderid) INNER JOIN FilteredProduct
ON FilteredProduct.productid = FilteredSalesOrderDetail.productid) INNER JOIN FilteredSystemUser
ON FilteredSystemUser.systemuserid = FilteredSalesOrder.ownerid)
So to summarize:
Upvotes: 0
Views: 202
Reputation: 619
It returned an error because the query returned more than 665 Columns and apparently SQL can't handle that.
This was solved by adjusting the connection string when you open the report in notepad++ you can alter it to match your production environment.
That is something that the report handles itself when you make the report using the report wizard of Visual Studio 2008 on the SQL Server. If you drag and drop fields from your dataset. The report will only take the first record it finds.
Upvotes: 1