Looping on the rows of a table in VB

1

I'm trying to make this looping between the rows in the database work. I have code ready in C # and I'm using it as a reference but I can not get this part to run.  Here it goes something like this:

    For Each Row In ds.Tables(0).Rows
        barcode.CodeToEncode = dr("productId")
        dr("Barcode") = barcode.generateBarcodeToByteArray()
    Next
    
asked by anonymous 13.11.2017 / 23:30

1 answer

0

I have solved the problem. The code looks like this:

    For Each Row As DataRow In ds.Tables(0).Rows
        barcode.CodeToEncode = Row("productId")
        Row("Barcode") = barcode.generateBarcodeToByteArray()
    Next

The confusion I had made was with the "dr" in the C # code it was:

foreach (DataRow dr in ds.Tables[0].Rows) 

And I did not know dr was a DataRow type variable ...

    
14.11.2017 / 00:04