Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Refering to fields in a recordset
Message
 
À
28/04/2000 04:14:14
Information générale
Forum:
Visual Basic
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Divers
Thread ID:
00364366
Message ID:
00364382
Vues:
22
>I have a recordset based on an SQL query, it includes more than one table. How do I refer to this in code?
>
>In the past I have only used recordsets consiting of one table and so I have used the sytanx
>
>recordsetname!fieldname
>
>but there could be more than one field with the same name in the recordset that I am using now, but from different tables,
>
>I tried
>
>recordsetname!tablename.fieldname and
>recordsetname!tablename!fieldname
>
>but had no luck with either.
>
>Can someone help please?

A recordset can't contain 2 fields with the same name. You have to use aliases to make them unique. The syntax is the following:
SELECT A.ID as ID1, B.ID as ID2, A.LName
FROM A, B
WHERE ...
Now in your application, you have to use aliases (if aliases are given) instead of the real field name.
recordsetname!ID1
recordsetname!ID2
recordsetname!LName
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform