Traning with Diabetes

The last time I went to the gym it happened to me that faint and was for maybe 1 or 2 seconds in a coma. they had called the ambulance and they gave me some water mixed with sugar. the people of the gym I had to go home for rest after I maybe strange enough asked if I could go on with my training!!! It happened when I almost had finished my training and it was if I had left my own body and I experienced the people in the gym very strange. If I wasn’t there.

Can somebody give advice/tips to avoid such a situation when I start with training again?

I have diabetes type 2.