vb.net获得dataset的内容

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Private ds As DataSet  New DataSet 
        Dim dt As DataTable = Me.ds.Tables("tableSample")
        Dim row As DataRow = dt.NewRow

        Dim str As String = String.Empty
        For Each row In dt.Rows

            For i As Integer = 0 To row.ItemArray.Length - 1
                str = str & (row.ItemArray(i).ToString)
                str = str & ","
            Next
            str = str.Remove(Len(str) - 1, 1)
            str = str & vbCrLf
        Next

        MessageBox.Show(str)
    End Sub 

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页