• SortedList小用



    使用SortedList类建立排序的DropDownList 
    SortedList 类类似于 Hashtable 和 ArrayList 间的混合。与 Hashtable 一样,SortedList 也基于 IDictionary 接口

    ;因此,SortedList 的每一元素都是键和值对。SortedList 提供只返回键列表或只返回值列表的方法。与 ArrayList 

    一样,SortedList 是元素序列。它被索引,并且根据特定的比较器被排序。SortedList 在所有 Collections 类中是唯

    一的,在其中每一元素都可通过三种方式访问:使用键、值或索引。

    如果您想要一个保存键
    /值对的集合并且还需要索引列表的灵活性,请使用 SortedList。

    -------------------------------------------------------------------------------------------------
    示例:


     SortedList Sl
    =new SortedList();
     Sl.Add(
    "项一","1");
     Sl.Add(
    "项二","2");
     Sl.Add(
    "项三","3");
     Sl.Add(
    "项四","4");

    //绑定DropDownList
    DropDownList1.DataSource 
    = Sl;
    DropDownList1.DataValueField 
    = "Value" ;
    DropDownList1.DataTextField 
    = "Key" ;
    DropDownList1.DataBind() ;

      
    Private _Detail_Qty_List As SortedList
      
    Public Property Detail_Qty_List() As SortedList
            
    Get
                
    Return _Detail_Qty_List
            
    End Get
            
    Set(ByVal Value As SortedList)
                _Detail_Qty_List 
    = Value
            
    End Set
        
    End Property

        
                
    If Me._Detail_Qty_List.Count > 0 Then
                    
    For Each itmQty As DictionaryEntry In Me._Detail_Qty_List
                        
    If Not (itmQty.Value = 0Then
                            strSQL 
    = "UPDATE Return_Detail SET Detail_Qty=" & itmQty.Value & " WHERE SN=" & 

    itmQty.Key 
    & ""
                            run.ExecuteNonQuery(conn.CONN_STRING, CommandType.Text, strSQL)                   
                        
    End If
                    
    Next
                
    End If
  • 相关阅读:
    一、Docker前提介绍
    CentOS6.10忘记MySQL8密码的解决办法
    阿里云服务器结合域名解析部署springboot项目到Tomcat
    Javap指令集
    微服务之路(十一)spring cloud stream
    微服务之路(十)spring cloud zuul
    微服务之路(九)spring cloud feign
    微服务之路(八)spring cloud netflix hystrix
    python连接oracle数据库
    单元测试-unittest模块
  • 原文地址:https://www.cnblogs.com/ding0910/p/308476.html
Copyright © 2020-2023  润新知