Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ComboBox Load
Message
 
To
21/10/2003 10:31:24
General information
Forum:
ASP.NET
Category:
Forms
Title:
Miscellaneous
Thread ID:
00839795
Message ID:
00840684
Views:
20
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?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform