How can I get a specific row or cell value from a DataColumn without using a DataGrid?

This is the code I have:

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

For example, I want to access the second cell value in "Columna". How can I do this without using Datagrid?

+3
source share
1 answer

Rows and columns are indexed starting from zero, so the second row will be indexed as 1:


SolTabla.Rows(1)(Columna)
+4
source

Source: https://habr.com/ru/post/1715658/


All Articles