Solved

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

Posted on 2008-06-23
3
383 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access/Visual Basic Question 3 44
C# XML Get Values 4 37
vb.net background worker crossthread 11 30
Create simple VB.net Add-in for Excel in Office 365 2 28
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

696 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