Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Query as Datasource for Datagridview: Query not Listed as an Option

Posted on 2008-06-23
3
381 Views
Last Modified: 2013-11-26
In Visual Basic 2008, I have a simple form with a Datagridview control.  I have a project dataset in which I have attached perhaps 20 tables from my SqlServer Database.  I have made a query that joins 2 tables and there is a query table adapter shown in the dataset explorer, and the query table adapter shows my query, named Lookupvisits().  On the Datagridview, when I click on "choose data source" and I expand the tree structure of my project datasources, the query is not shown.  What am I doing wrong? of note, when I click on the query properties, the execute mode property shows 'scalar'- "reader" is not an option, if that matters.  Thank you.
0
Comment
Question by:SqlServerDoc
  • 2
3 Comments
 
LVL 41

Accepted Solution

by:
graye earned 125 total points
ID: 21846030
When you built the query in the DataSet designer, did you use the "Query" object or the "TableAdapter" object?

It may seem a bit counter-intuitive, but if your query returns a table, you should use a TableAdapter rather than a Query
0
 

Author Closing Comment

by:SqlServerDoc
ID: 31469714
Excellent.  I wish there was better documentation (msdn etc) available! thank you!
0
 

Author Comment

by:SqlServerDoc
ID: 21846201
For other beginners, when defining a query datasource in the designer, click on Add > Table Adapter rather than query.
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question