Toon posts:

[VS2005] Dataset designer voegt niet autom. kolom toe

Pagina: 1
Acties:

Verwijderd

Topicstarter
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):
quote: Microsoft Visual Studio
The 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.
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:
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.
Aan de andere kant vind ik dit artikel (http://www.asp.net/QUICKS...ata/objectdatasource.aspx) waarin gezegd wordt:
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.
Mis ik nou iets in VS?

  • DoDo
  • Registratie: Juli 2001
  • Laatst online: 12:57
Als je er een met meer kolommen hebt, moet je een nieuwe dataadapter aanmaken, met de query waar die "meer" velden uitkomen!

  • whoami
  • Registratie: December 2000
  • Laatst online: 16:54
-> DT&E

https://fgheysels.github.io/


Verwijderd

Topicstarter
Bedankt DoDo, dus de tutorial die rept van het automatisch toevoegen van een kolom indien je een query toevoegt met extra kolommen is niet correct? Misschien was dat een eerdere versie (beta) van VS, de kolom is van Scott Guthrie, dus vandaar dat ik het maar voor waar aannam.

Ik denk dat ik dan liever de originele tableadapter aanpas, lijkt me overzichtelijker.