Looping in Rows of a VB table

Asked

Viewed 41 times

1

I’m trying to make this loop between the Rows in the database work. I have a code ready in C# and I’m using it as a reference, but I can’t get this part to run. It was like this:

    For Each Row In ds.Tables(0).Rows
        barcode.CodeToEncode = dr("productId")
        dr("Barcode") = barcode.generateBarcodeToByteArray()
    Next
  • Sorry, VB6, that’s my first question here.

1 answer

0


I’ve already 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 that was:

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

And I didn’t know that Dr was a Datarow-type variable...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.