I use Execute Reader to get a list of data and want to add to the datatable.
I got an error in the 1st row. "Specified arguement was out of the range of
valid values. Parameter name :rowindeX"
my code is listed as following :Please be kind to help me take a look. I
really don't know what's wrong it is.
Dim drRv As SqlDataReader
Dim myDatarow As DataRow
drRv = cmdRv.ExecuteRe ader
While drRv.Read
myDatarow = Me.dtInvCharges .NewRow()
MessageBox.Show (drRv.Item("bas eamt")) <--- It can show the
correct value
intCounter += 1
With myDatarow
.Item("acctcode ") = drRv.item("acct code") <--- It got
that errors.
End With
Me.dtInvCharges .Rows.Add(myDat arow)
end while
I got an error in the 1st row. "Specified arguement was out of the range of
valid values. Parameter name :rowindeX"
my code is listed as following :Please be kind to help me take a look. I
really don't know what's wrong it is.
Dim drRv As SqlDataReader
Dim myDatarow As DataRow
drRv = cmdRv.ExecuteRe ader
While drRv.Read
myDatarow = Me.dtInvCharges .NewRow()
MessageBox.Show (drRv.Item("bas eamt")) <--- It can show the
correct value
intCounter += 1
With myDatarow
.Item("acctcode ") = drRv.item("acct code") <--- It got
that errors.
End With
Me.dtInvCharges .Rows.Add(myDat arow)
end while
Comment