I usually create function to control sprites priority just like that:
void SpritesPriority()
{
dbSetSpritePriority(1,1); // Sprite: 1, Priority: 1
dbSetSpritePriority(2,2); // Sprite: 2, Priority: 2
dbSetSpritePriority(3,3); // Sprite: 3, Priority: 3
dbSetSpritePriority(4,4); // Sprite: 4, Priority: 4
dbSetSpritePriority(5,5); // Sprite: 5, Priority: 5
(...)
}
In that case sprite with id = 1, will be on "bottom" of screen, then on top of it will be sprite 2 and so on....
Just insert that somewhere in you game/program main loop.