Results 1 to 2 of 2

Thread: SQL Query Builder Problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2006
    Posts
    24

    Arrow 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?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width