> '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 >