Home » Asp.netRSS

Gridview and Inner Join Query

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. 

 

2 Answers Found

 

Answer 1

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).

 

Answer 2

I have same problem , please tell how you solve ?  

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter