Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding more fields into a dataset
Message
De
22/05/2013 10:24:12
 
 
À
22/05/2013 09:54:53
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01574472
Message ID:
01574478
Vues:
45
>I have a dataset that is constructed from various sources. So, the number of fields in them varies from one places to another. However, it is all for the same table. The goal is to find the missing fields and add them into the dataset.
>
>The first part is to detect the missing field. This is no problem. I have a collection of all the required fields. I compare with what I have in the dataset. If it is not in there, I add them up in a variable such as "Table.FirstName,Table.LastName,etc.". Some sources may have 1 record, others 136 and so on. So, I need to execute a SQL command which will go get the missing field values from the table so the result would be the final version of the dataset.
>
>Once step I have to go through is to get all the primary keys. So, lets say I have them up in a collection, in a list such as "12, 1024, 3244, 1211" or else. I then need to execute a SQL command to get the missing fields based on those primary keys. I am pretty sure there is a better way to achieve that then to construct a SQL command with a bunch of WHERE clauses with an OR statement for each of the primary key. Anyone would have an idea on a better route to take?

not sure if I have a correct mental picture, but assuming you have a already consolidated table you currently plan to get the missing data from, might it not be easier to get a copy from there of all records with pk in [PkFoundInDataset] itno a temp table and only update this temp table with existing/found values from the dataset ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform