怎麼判斷ds中是否有一個指定項

int isFind = 0;
        for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
        {
            if (ds.Tables[0].Columns[i].ColumnName.ToString().Trim() == "testName")
            {
                isFind = 1;
            }
        }

        if (isFind == 1)
        {
            //找到了列名
        }

vb.net
 Dim ii As Integer = 0
            For ii = 0 To ds.Tables("Vendor_goods").Columns.Count - 1
                If ds.Tables("Vendor_goods").Columns(ii).ColumnName.ToString.Trim = "c0" Then
                    Me.lb_msg.Text = "找到了c0"
                Else
                    Me.lb_msg.Text = "mei找到了c0"

                End If

 

            Next

posted @ 2006-10-13 13:58  Nina  阅读(214)  评论(0编辑  收藏  举报