locked
Gridview and Inner Join Query RRS feed

  • Question

  • User-1287354701 posted

    I'm am having an issue having a column show up in GridView.  I have two Access tables, Customers and Contacts.  The Customers table has a primary key of CustomerID, as well as having all the customer information.  The Contacts table has a primary key of ContactID, a foreign key of CustomerID with a relationship set up between these two tables, as well as the rest of the contact's information.  In the GridView, I'd like to show the contact details, but I would also like to show CustomerName (a value in the Customer table).  I've created a dataset with these two tables and I've added a query with the inner join included under the ContactsTableAdapter.  When I execute this query in the query builder, it looks like it works great.  When I attempt to use this as an object data source for the gridview, all I get are the columns from the Clients table.  Any ideas?  I'm a little new to ASP.NET, so I may have missed something simple. 

    Tuesday, May 19, 2009 3:20 PM

Answers

  • User-1287354701 posted

    I have solved my problem, but still not exactly sure as to why the original way I had tried did not work.  Basically what I found was that I needed to add the Customers table to the Contacts table adapter main query.  If I try to do the inner join on an added query without doing this, I guess the schema does not match (which it was giving me a warning message, but since the project was building ok, I had ignored).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 20, 2009 2:24 PM

All replies

  • User-1287354701 posted

    I have solved my problem, but still not exactly sure as to why the original way I had tried did not work.  Basically what I found was that I needed to add the Customers table to the Contacts table adapter main query.  If I try to do the inner join on an added query without doing this, I guess the schema does not match (which it was giving me a warning message, but since the project was building ok, I had ignored).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 20, 2009 2:24 PM
  • User685381060 posted

    I have same problem , please tell how you solve ?  

    Monday, November 1, 2010 10:00 AM