Sub test()
Dim dt As DataTable
Dim dv As DataView = New DataView
Dim dr As DataRow()
Dim ds As DataSet
Dim sL_Rnl As String
dv = DatabaseFun.GetSQLData(" Select aaa From xxx")
'dv 轉 dt
dt = dv.Table
'dv 轉 ds
ds = dv.Table.DataSet
'dv 轉 dr
dr = dv.Table.Select
'dt 轉 dv
dv = dt.DefaultView
dv.Table = dt
'dt 轉 ds
ds.Tables.add(dt)
ds = dt.DataSet
'dt 轉 dr
dr = dt.Select()
'ds 轉 dt
dt = ds.Tables(0)
'ds 轉 dv
dv = ds.Tables(0).DefaultView
'ds 轉 dr
dr = ds.Tables(0).Select()
'dv讀取資料
For i = 0 To dv.Table.Rows.Count - 1
sL_Rnl = If(IsDBNull(dv.Table.Rows(i).Item("aaa")), "", dv.Table.Rows(i).Item("aaa"))
Next
'dt讀取資料
For i = 0 To dt.Rows.Count - 1
sL_Rnl = If(IsDBNull(dt.Rows(i).Item("aaa")), "", dt.Rows(i).Item("aaa").ToString.Trim)
Next
'dr讀取資料
For i = 0 To dr.Length - 1
sL_Rnl = If(IsDBNull(dr(i)("aaa")), "", dr(i)("aaa").ToString.Trim)
Next
End Sub
留言列表