In visual studio put a break point at the line
LabelProductIDviewcheckout.Text = order3.Rows(0)("ProductID")
and check whether there are any rows in the order3
DataTable
using the
data visualizer
, because the reason for
"There is no row at position 0 error" is that there are no rows in the table. To avoid that error better check for the number of
Rows
in the
order3 DataTable
as below
If order3.Rows.Count > 0 Then
LabelProductIDviewcheckout.Text = order3.Rows(0)("ProductID")
LabelProductNameviewcheckout.Text = order3.Rows(0)("ProductName")
LabelProductQuantityviewcheckout.Text = order3.Rows(0)("ProductQuantity")
LabelProductPriceviewcheckout.Text = order3.Rows(0)("ProductPrice")
End If