TableAdapter to return ONLY selected columns? (VS2008)

Posted by MattSlay on Stack Overflow See other posts from Stack Overflow or by MattSlay
Published on 2009-03-30T15:17:18Z Indexed on 2010/05/15 3:04 UTC
Read the original article Hit count: 310

(VS2008) I'm trying to configure a TableAdapter in a Typed DataSet to return only a certain subset of columns from the main schema of the table on which it is based, but it always returns the entire schema (all columns) with blank values in the columns I have omitted.

The TableAdpater has the default Fill and GetData() methods that come from the wizard, which contain every column in the table, which is fine. I then added a new parameterized query method called GetActiveJobsByCustNo(CustNo), and I only included a few columns in the SQL query that I actually want to be in this table view.

But, again, it returns all the columns in the master table schema, with empty values for the columns I omitted.

The reason I am wanting this, is so I can just get a few columns back to use that table view with AutoGenerateColumns in an ASP.NET GridView. With it giving me back EVERY column i nthe schema, my presentation GridView contains way more columns that I want to show th user. And, I want to avoid have to declare the columns in the GridView.

© Stack Overflow or respective owner

Related posts about tableadapter

Related posts about strongly-typed-dataset