SQL 如下
" SELECT " & vbCrLf & _
" ID_NO, " & vbCrLf & _
" AA, " & vbCrLf & _
" BB, " & vbCrLf & _
" CC, " & vbCrLf & _
" DD, " & vbCrLf & _
" FROM " & vbCrLf & _
" table_dual "
以上SQL会返回DataSet数据
从DataSet中获取数据可以有两种方式
第一种——利用列明取得数据
Dim ds As DataSet
ds=xxxxxxxxxxx(调用SQL方法)
If ds.Tables(0).Rows.Count > 0 Then
With ds.Tables(0).Rows(0)
'IDNO
idNoTxt.Text = String.Concat(.Item("ID_NO"))
'AA
Dim AA As String = String.Concat(.Item("AA"))
End With
End If
第二种——利用DataRow取得数据,index从零开始,要注意列的排列顺序
Dim ds As DataSet
ds=xxxxxxxxxxx(调用SQL方法)
For Each dr As DataRow In ds.Tables(0).Rows
'IDNO
idNoTxt.Text = String.Concat(dr(0))
'AA
Dim AA As String = String.Concat(dr(1))
Next