Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ComboBox Load
Message
 
À
21/10/2003 10:31:24
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Divers
Thread ID:
00839795
Message ID:
00840684
Vues:
21
Have a look
Public Sub LoadUserCombo(ByRef cbo As ComboBox)
            'Load the combobox
            Dim sSQL As String
            Dim dt As New DataTable()

            'Get the users
            sSQL = " SELECT nlUserID, tUserName "
            sSQL += " FROM Users "
            sSQL += " WHERE (lDeleted = " & oSQLUser.SQLBoolean(False) & ") "
            sSQL += " ORDER BY tUserName "

            Try

                'Open the connection
                oSQLUser.ConnectionString = Constants.SIMON_SQL_Connect
                oSQLUser.OpenDBConnection()

                'Get the datatable
                dt = oSQLUser.GetDataTable(sSQL)

                'Close the connection
                oSQLUser.CloseDBConnection()

                'Bind it to the combobox
                cbo.DataSource = dt
                cbo.DisplayMember = "tUserName"
                cbo.ValueMember = "nlUserID"
                cbo.SelectedIndex = 0

            Catch exp As Exception
                RaiseEvent ErrorRaised(exp.Source, exp.Message)
            End Try

        End Sub
If I dispose of the datatable in this sub then the combobox will not be loaded. Any suggestions?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform