Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loading A Combobox - With Code
Message
De
13/03/2003 21:15:32
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00765655
Message ID:
00765668
Vues:
18
This message has been marked as a message which has helped to the initial question of the thread.
Kirk,

Your code looks ok to me ... nothing jumps out at me as glaringly wrong or anything. But, you'll have to remember that I do C#, not VB, so maybe I'm missing something subtle. Sorry, maybe someone else can jump in with some ideas.

Sorry I'm no help ... =(
~~Bonnie


>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
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform