Als ik in VS 2005 Pro een dataset ontwerp, en een tableadapter+datatable toevoeg, dan krijg ik in eerste instantie de kolommen die in de eerste select-query/sproc voorkomen. Hiermee wordt het schema gemaakt.
Maar als ik een query toevoeg met andere/meer kolommen, dan krijg ik van Visual Studio een waarschuwing, dat het resultaat van die query niet overeenkomt met het schema (van die datatable):
Maar als ik een query toevoeg met andere/meer kolommen, dan krijg ik van Visual Studio een waarschuwing, dat het resultaat van die query niet overeenkomt met het schema (van die datatable):
Is het niet de bedoeling dat VS dan die kolom toevoegt? Ik zie dit nergens in de opties van VS, en de help bied ook geen uitkomst. Ik lees nu een tutorial (http://weblogs.asp.net/sc...ve/2006/01/15/435498.aspx) waarin een kolom in zo'n situatie automatisch toegevoegd wordt als read-only volgens de auteur:quote: Microsoft Visual StudioThe new command text returns data with schema different from the schema of the main query. Check your query's command text if this is not desired.
Aan de andere kant vind ik dit artikel (http://www.asp.net/QUICKS...ata/objectdatasource.aspx) waarin gezegd wordt:Specifically, there in addition to retrieving the Products table columns I’m also retrieving the CompanyName from the Suppliers table that maps to the Product’s SupplierId column (it has a foreign key relationship to the Suppliers table). The above SQL statement will add this as a read-only “SupplierName” column on our ProductsDataTable.
Mis ik nou iets in VS?You can also add additional queries, provided they return the same schema (fields), to a TableAdapter by right-clicking the TableAdapter box in the designer.