Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dealing With Nulls and SQL
Message
De
18/06/2002 12:20:21
Jason Dalio
Northern Interior Regional Health Board
Prince George, Colombie Britannique, Canada
 
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Titre:
Dealing With Nulls and SQL
Divers
Thread ID:
00669800
Message ID:
00669800
Vues:
41
I'm having a coding issue where I know I am doing something inefficiently. When a field is left blank on my form I want a NULL stored in the SQL table. When a field is NULL in the table I have to deal with it before placing the value in the form fields (I know this one can be accomplished by including double quotes with the field). Right now it seems like I am using far too much code to deal with the NULLs. Can someone point out "the better way"?

Loading Values
If Not IsNull(RSLoadData.Fields("GenderDesc")) Then
    cboGender.Text = RSLoadData.Fields("GenderDesc")
End If
Saving Values
If Trim$(txtStreetAddress2.Text) <> "" Then
    RSSaveData.Fields("StreetAddress2") = txtStreetAddress2.Text
Else
    RSSaveData.Fields("StreetAddress2") = Null
End If
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform