Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loading A Combobox - With Code
Message
 
À
13/03/2003 20:27:29
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00765655
Message ID:
00765663
Vues:
16
It does have data, I add code to get the count and it has 19 records, I moved the setting of the combobox to after the fill() and still no data. Still the combo doesn't load. Here is the newest code:
        'Create a Connection
        Dim Conn As SqlClient.SqlConnection
        'gcConnString is a public variable in the Globals.vb file
        Conn = New SqlClient.SqlConnection(gcConnString)

        Dim cmd As New SqlClient.SqlCommand()
        Dim da As New SqlClient.SqlDataAdapter()
        Dim ds_AuthDepts As New Data.DataSet()
        Dim cb As SqlClient.SqlCommandBuilder
        Dim prm As SqlClient.SqlParameter

        Try
            cmd = Conn.CreateCommand
            cmd.CommandText = "ct_lu_AuthorizedDeptsByUsers"
            cmd.CommandType = CommandType.StoredProcedure
            prm = cmd.Parameters.Add("@tiuserID", SqlDbType.Int)
            prm.Value = gnUserID

            da.SelectCommand = cmd
            da.Fill(ds_AuthDepts, "Departments")

            Dim lnCount As Integer
            lnCount = Me.BindingContext(ds_AuthDepts, "Departments").Count


            Me.ComboBox1.DataSource = Me.ds_AuthDepts.Tables("Departments")
            Me.ComboBox1.DisplayMember = "DeptDesc"
            Me.ComboBox1.ValueMember = "DeptID"

            MsgBox(lnCount)



        Catch ex As Exception
            MsgBox("Error: " & ex.Message)
        End Try
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform