这是我的代码:
Sub Main()
Dim dts As New DataSet
Dim da As New SqlDataAdapter
Dim SolTabla As New DataTable
Dim Columna As New DataColumn
Cnx As New SqlConnection("Some Connection String")
Dim vsql2 = "SELECT * FROM Table1 where code = '" & value & "'"
da = New SqlDataAdapter(vsql2, Cnx)
da.Fill(dts, "SomeTable")
SolTabla = dts.Tables(0)
Columna = SolTabla.Columns(0)
...
End Sub
例如,我想访问“Columna”中的第二个单元格值。如何在不使用Datagrid的情况下执行此操作?
答案 0 :(得分:4)
行和列从零开始编制索引,因此第二行将编入索引为1:
SolTabla.Rows(1)(Columna)