You condition shpuld be like this(in hope transactionnumber starts from 1…if it starts from 0 then in condition remove equals and in next statement remove -1)
Hi, Thank you for your reply.
However, it seems you did not answer my question properly…
What I want to know is whether my algorithm is correct or not.
I imagined the next sentence could be used in case String.Empty are fully filled in one Excel line.
Am I correct?
Your if condition will never go inside the assign when there is no row…so your assign is never failing…there is no point of having second if condition at all…
day your table has 3 rows…then your first if condition will be true for 3 times and your assign will assign each row and never the second if will be true because everytime there is a row…
4th time when it comes there the first if condition is false as transactionnumber is 4 and rowcount 3…so it wont move inside also…so effectively your second if condition is neevr executed becasue dr_transactionitem will never be empty
you can try creating a table with 2 rows and try assign with dt.Rows(2) and it would throw error …as rows are only two and index will be 0 or 1 and not 2