すると・そこで: the difference
するとN3
Meaning
Having done..., If...is done...,
Past papers
Tested 5 times in past papers
Example
口笛を吹いた。すると、小鳥がやって来た。
I whistled, and a little bird came.
そこでN3
Meaning
Accordingly, Now, Therefore, To that end
Past papers
Tested 6 times in past papers
Example
私は彼女を愛している。そこで、結婚を申し込むことに決めた。
I love her. Accordingly, I decided to ask her to marry me.
How to tell them apart
What follows 「すると」 is something that happens naturally or a deduction, not your own order, request or decision. Don't say 「×窓を開けた。すると、勉強しよう」.
「そこで」 means that because of the situation, you deliberately did something: 「雨が降ってきた。そこで傘を買った」.
「それでは」 moves on to the next step or sums up: 'well then'.