2016-12-04 61 views
-2

我有VB.NET應用程序,它顯示gridview中表的數據。在VB.NET中循環返回數據集的行

Dim DbaseDataSet As DreamApp.DbaseDataSet = CType(Me.FindResource("DbaseDataSet"), DreamApp.DbaseDataSet) 
    Dim DbaseDataSetDevicesTableAdapter As DreamApp.DbaseDataSetTableAdapters.DevicesTableAdapter = New DreamApp.DbaseDataSetTableAdapters.DevicesTableAdapter() 
    DbaseDataSetDevicesTableAdapter.Fill(DbaseDataSet.Devices) 
    Dim DevicesViewSource1 As System.Windows.Data.CollectionViewSource = CType(Me.FindResource("DevicesViewSource1"), System.Windows.Data.CollectionViewSource) 
    DevicesViewSource1.View.MoveCurrentToFirst() 

查詢返回的值是:

SELECT [Name], [Username], [Password], [IP], [Type], [Curr] FROM [Devices] 

而我的表是充滿了正確的數據。 我將如何遍歷每個循環所返回的行,並使用上述查詢中的返回值爲每個返回的行運行一段代碼。

回答

-1

只是遍歷Rows財產

For each drRow as Datarow in DbaseDataSet.Devices.Rows 

.... 
'DrRow("colname") = something 

Next 
+0

坦克,你的先生!讚賞 – Thomas

+0

爲什麼downvoting! – Hadi