Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make Datagridview only show select columns from joined query?

Status
Not open for further replies.

Curtis360it

IS-IT--Management
Nov 7, 2005
88
0
0
US
I have a joined table query that shows correctly when I preview the query in DataSet designer but when it loads to the datagridview it shows all columns from both tables. How can I make it only show the columns that I explicitly chose when I designed the query? For instance:

Table 1
1.Name - Output
2.Number
3.Age - Output

Table 2
1. Income
2. Position - Output
3. Location - Output

I want the datagridview to ONLY show the columns I chose to OUTPUT.

Thanks!
 
either:
clean your select to only return the columns you want

or

DataGridView1.Columns("Name").Visible = False

-The answer to your problem may not be the answer to your question.
 
Yea I did clear it to only show the ones I want, and it works when I preview it. The datagrid for some reason will actually create the column headers but leave the cells blank....weird.
 
From the sounds of it, you are using the wizard, it may be a check box somewhere to hide the columns that you don't need, or else you will have to set them .visible = false by hand.

-The answer to your problem may not be the answer to your question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top