zoukankan      html  css  js  c++  java
  • DataTable.Select() 方法的简单用法

    这个方法还是比较好用的,可以得到在datatable里你想要的符合条件的多个列 我的代码里用的是强类型dataset(项目里用的) 下面是代码片段,不完整,只是说明的用法
     If arrSyouhinCDList.Count > 0 Then
                        For i = 0 To arrSyouhinCDList.Count - 1
                            strSyouhinCD = arrSyouhinCDList(i).ToString
                            Dim rows() As DataRow
                            rows = dsM_syouhin_daihyou_kanren.m_syouhin_daihyou_kanren.Select("syouhin_cd='" & strSyouhinCD & "'")

                            For Each row As DataRow In rows
                                strDaihyouCD = row.Item("daihyou_cd").ToString
                                arrDaihyouCDList.Add(strDaihyouCD)
                            Next
                            arrAllDaihyouCD.Add(arrDaihyouCDList)
                            arrDaihyouCDList.Clear()
                        Next i
                    End If


    select方法里的参数叫"FilterExpression",写法就像拼SQL字符串一样
    select方法的返回值是Datarow()(datarow集合,就是多个datarow) 再用for each方法取得想要的值就行了

    Powered by ScribeFire.

  • 相关阅读:
    准备用协程模拟经典的生产者消费者
    重载操作符号
    对象池
    ssh加key
    oracle存储过程(PL/SQL)
    获取服务器ip地址
    【STL系列】结构体排序
    strtol sort snprintf snscanf strtok
    cxGrid动态创建带CheckBox列时遇到的问题...
    Windows2003 安装PostgreSQL9.0 UUID解决‘ERROR:无法载入程式库’问题
  • 原文地址:https://www.cnblogs.com/lost0/p/862350.html
Copyright © 2011-2022 走看看