Solved

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

Posted on 2008-06-23
3
372 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
Comment Utility
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
Comment Utility
Excellent.  I wish there was better documentation (msdn etc) available! thank you!
0
 

Author Comment

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

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now