What is the correct useage for processing dataadapter rows

I have a table that is returning rows from a table query. It seems I have done it before but I cannot seem to get the right procedure to obtain the values. I will paste in the code below in which you will see my bad attempts at accomplishing what I need. I will appreciate an answer, an example or sample that will get me over this seemingly easy question.

Public Class Form1
    Dim uid As String
    Dim pw As String
    Dim em As String, fn, ln, mi As String
    Dim par As String
    Dim Field, n, j As Integer
    Dim JJ As Integer

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim loginAdapter As New STRATEGYDataSetTableAdapters.LOGINTableAdapter
        Dim theDataSet As New STRATEGYDataSet
        Dim row As String, kk As Integer, indexx As Integer, item As Integer  
        Dim dvSql As DataView = New DataView(theDataSet.LOGIN)
        Dim dvrow As New DataView
        JJ = loginAdapter.GetData.Rows.Count
        On Error GoTo register
        For kk = 1 To jj
            item = kk - 1
            'Each dvsql In theDataSet.Tables("LOGIN").Rows
            JJ = loginAdapter.GetData.Rows.Count
            'row = loginAdapter.GetData.Rows(theDataSet.LOGIN)
            'uid=dvsql.item(0)
            'em = dvsql.Item(1)
            'pw = dvsql.Item(2)
        Next
register:
    End Sub
End Class
September 8th, 2015 11:27pm

Quick first example I found in my C# project

 DataRow rowSource = dsPasses.Tables[0].Rows[0];
                    DataRow rowTarget = dsPasses.Tables[1].Rows[0];

                    //US 13401 - update WTP Number only when the AccessControl.PreserveWTPHistoricalData = .F.
                    

                    if (!this.bPreserveWTPHistoricalData)
                    {
                        String oldWTP_No, newWTP_No;

                        oldWTP_No = rowSource.Field<String>("wtp_no").Trim();
                        newWTP_No = rowTarget.Field<String>("wtp_no").Trim();
In other words, you can use foreach loop to navigate through DataSet.Rows collection and then either use Columns collection or alternative Field syntax.

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 12:21am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics