Understanding product of function fields for a reduced scheme of finitely many irreducible components Let $(X,\mathcal O_X)$ be an integral affine scheme. Then clearly the injection $\mathcal O_X(X) \hookrightarrow K(X)$ of $\mathcal O_X(X)$ into its fraction field $K(X)$, makes $K(X)$ a flat $\mathcal O_X(X)$ module. 
Now, let $X$ be a reduced scheme with finitely many irreducible components $\{X_\lambda\}$. Each $X_\lambda$ can be given a reduced closed subscheme structure and hence each $X_\lambda$ becomes integral subschemes of $X$. And therefore, as before we can say that $K(X_\lambda)$ is a flat $\mathcal O_X(X_\lambda)$ module. Indeed we have a map,
$$\mathcal O_X(X)\longrightarrow \mathcal O_{X_\lambda}(X_\lambda)\hookrightarrow K(X_\lambda).$$ This induces the map 
$$\mathcal O_X(X)\longrightarrow \prod K(X_\lambda).$$
I want to understand if it true that $\prod K(X_\lambda)$ is a flat $\mathcal O_X(X)$ module? Even if it's not true, I would like to understand the relation between $\mathcal O_X(X)$ and $\prod K(X_\lambda)$. 
Thanks in advance!
 A: As Laurent Moret-Bailly alludes, the result is false without some additional hypotheses.  For instance, let $X$ be the locally closed subscheme of $\mathbb{P}^3_k = \text{Proj}\ k[x,y,z,w]$ that is the open subscheme of $\overline{X}=\text{Zero}(xy,xz)$ whose complement is the closed point $[x,y,z,w]=[1,0,0,0].$  Thus $\overline{X}$ has two irreducible components: a $2$-plane, $\text{Zero}(x),$ and a line, $\text{Zero}(y,w).$  The fraction fields of these components are purely transcendental extensions of $k,$ $k(y/w,z/w)$ and $k(x/w)$ respectively.  
The ring of global sections $\mathcal{O}_X(X)$ equals $k[t]=k[x/w].$  The field $k(x/w)=k(t)$ is certainly flat over $k[t]$.  However, the second field, $k(y/w,z/w),$ is isomorphic as a $k[t]$-module to $(k[t]/tk[t])(y/w,z/w).$  Thus, it is not flat as a $k[t]$-module.
If you add the hypothesis that $X$ is affine, then the total ring of fractions of $\mathcal{O}_X(X)$ is indeed flat over $\mathcal{O}_X(X),$ since it is a localization, as Mohan points out.
Edit. The OP added the hypothesis that $X$ is affine.  In this case, for the multiplicative system $S$ of nonzero divisors in $\mathcal{O}_X(X)$, the fraction ring $S^{-1}\mathcal{O}_X(X)$ equals the product over the finitely many minimal prime ideal $\mathfrak{p}\subset \mathcal{O}_X(X)$ of the fraction field $\kappa(\mathfrak{p})=\mathcal{O}_X(X)_{\mathfrak{p}}$.  As a fraction ring, $S^{-1}\mathcal{O}_X(X)$ is flat as an $\mathcal{O}_X(X)$-module.  Indeed, it equals the colimit of the system of rank-one, free modules $\mathcal{O}_X(X)e_s$, where $s\in S$ is an element, where $e_s$ is a placeholder basis element, and where for $s,t\in S$, the associated homomorphism $\mathcal{O}_X(X)e_s\to \mathcal{O}_X(X)e_{st}$ sends $e_s$ to $te_{st}$.  As a colimit of flat $\mathcal{O}_X(X)$-modules, also $S^{-1}\mathcal{O}_X(X)$ is a flat $\mathcal{O}_X(X)$-module.
