SQL Query Builder Problem
Hi,
Im having a problem with the SQL Query wizard. I get the following error message. "The schema returned by the new query differs from the base query".
Heres the code below that was generated from what i wanted to achieve;
Code:
SELECT [Order].OrderID, [Order].Review, Customer.CustomerID, Customer.CustomerName, Customer.PhoneNumber, Card.CardID, Card.CardNumber, Card.ExpiryDate, Delivery.DeliveryID
FROM ((([Order] INNER JOIN
Card ON [Order].CardID = Card.CardID) INNER JOIN
Customer ON Card.CustomerID = Customer.CustomerID) INNER JOIN
Delivery ON [Order].DeliveryID = Delivery.DeliveryID AND Customer.CustomerID = Delivery.CustomerID)
WHERE ([Order].Review = TRUE)
Firstly i have a blank form, created the link to the database. dragged the 'order' data on the form and clicked on query builder to display additional data.
Basically the code is looking at 4 different tables. pulling all the information i need where 'Review' (checkbox) is TRUE. Basically i want to see just the items where the checkbox is ticked. When i click execute query, i can see the preview and looks fine. But when i click OK i get the error message as above.
Any ideas?
Re: SQL Query Builder Problem
That means that you have added a query to a DataTable/TableAdapter that produces a different result set with a different schema to the result set of the query that was used to create the DataTable/TableAdapter in the first place. I see that your query is returning columns from multiple database tables. Does your DataTable contain all those columns? If not then how can you store the result of that query in that DataTable?
If you want to create a query with a new result set schema then you'll need to add a new TableAdapter to your DataSet, not use an existing TableAdapter.