In this work, we study the prospect of detecting the stochastic gravitational-wave background with the TianQin observatory. We consider both astrophysical-origin and cosmological-origin sources, including stellar-mass binary black holes, binary neutron stars, Galactic white dwarves, inflation, first order phase transition, and cosmic defects. For the detector configurations, we considered TianQin, TianQin I+II and TianQin + LISA. We studied the detectability of stochastic gravitational-wave backgrounds with the assumed methods of both cross-correlation and null channel, and present the corresponding power-law integrated sensitivity curves. We introduce the definition of the joint foreground with a network of detectors. With the joint foreground, the number of resolved double white dwarves in the Galaxy will be increased by 5% $sim$ 22% compared with simple combination of individual detectors. The astrophysical background from the binary black holes and the binary neutron stars under the theoretical models are predicted to be detectable with signal-to-noise ratio of around 10 after five years operation. As for the cosmological sources, their models are highly uncertain, and we only roughly estimate the detection capability under certain cases.