Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verifying if a field exist in a row
Message
 
 
À
11/10/2010 12:08:18
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01484735
Message ID:
01484740
Vues:
25
>Once I have a datarow as a variable, if I wish to verify if a specific field exists in it, is the only way to Try/Catch for an error? I tried If Not loRow(lcField) Is Nothing but this generates an error if the field is not present in the row.

Can you do a verification from the SQL instead?

E.g.
if exists (select 1 from Information_Schema.Columns where Table_Name = @Table and Column_Name = @Column)
   -- column exists in the table
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform