You have been told what the problem is:
L get this an error on this line using (rdr as mysqldatareader = cmd.executereader()) rdr[
^]
Just dumping your code on us afterwards and basically saying "I don't know what I'm doing, you sort it out" isn't going to make you any friends here.
While I appreciate you have a task to do, it's what you are paid for, not us - so ignoring error messages that are explicit in saying what the problem is does not help your case.
And just throwing your entire code at us is plain rude.