Let $A$ be an integral domain, $K = \operatorname{Quot}(A)$ the field of fractions of $A$ and $X=\operatorname{Spec}(A) = \{p\subset A \mid \ p \ \text{prime ideal of }A \}$ the spectrum of $A$ with the Zariski topology. For every $p\in X$ the localization $A_p$ is a subring of $K$.
We take $\mathcal{O}_X$ the structure sheaf of $X$; for every open subset $U\subset X$, $\mathcal{O}_X(U)$ is the set of sections $s:U\rightarrow \bigsqcup_{p\in U}A_p $ such that $s(p)\in A_p$ for all $p\in U$ and locally a quotient of elements of $A$ (i.e. for each $p\in U$ there exists a neighborhood $V$ of $p$ contained in $U$ and elements $a,f\in A$ such that for each $q\in V$, $f\notin q$ and $s(q)=\frac{a}{f}\in A_q$)
We want to show that $$ \mathcal O_X(U) = \bigcap_{p\in U}A_p \subset K $$
My attempt
I found here a similar question, but there is not an answer. I think that the key point is the density of $\eta = (0)$ in $X$ thanks to the fact that $A$ is a domain.
I tried to show that a section $s\in \mathcal O_X(U)$ is not only locally a quotient of elements of $A$, but globally (on $U$) a quotient of elements of $A$. To do that, consider a neighborhood $V$ of $\eta$ and $a_1,f_1\in A$ such that for all $q\in V$, $s(q) = \frac{a_1}{f_1}$ and $f_1\notin q$ for all $q\in V$. Suppose that $V\neq U$. Hence there exists $p\in U \setminus V$ and a neighborhood $W$ of $p$ and $a_2,f_2\in A$ with the same properties as above.
Since $\eta$ is dense, $\eta\in W$ and we have $\frac{a_1}{f_1} = \frac{a_2}{f_2}$ in $A_\eta = K$. From here, I can find that $a_1\in p$, but I can't go any further if I don't add more hypothesis on $A$.
Could this be the right approach?
Thanks in advance
In an integral scheme, you can check that all restriction maps are injective. Thus, it follows that if $U \subset X$ is an open subset covered by the affine open subsets $V_i$, $\mathcal{O}(U) = \bigcap_i\mathcal{O}(V_i)$ (as subrings of $K$) by the sheaf property.
So it is enough to show the statement for affine open subsets $U$. In other words, we just need to show that if $A$ is an integral domain, $A = \bigcap_{\mathfrak{p} \in \operatorname{Spec}\,A}{A_{\mathfrak{p}}}$.
Of course, $\subset$ is obvious. Let's see the reverse inclusion. If $x \in \bigcap_{\mathfrak{p} \in \operatorname{Spec}\,A}{A_{\mathfrak{p}}}$, then there is an ideal $I \subset A$ such that $I = \{z \in A,\, zx \in A\}$. Since, for every $\mathfrak{p} \in \operatorname{Spec}\,A$, $x \in A_{\mathfrak{p}}$, $I \not\subset \mathfrak{p}$, and therefore $I$ is contained in no maximal ideal of $A$ so is $A$, and $x \in A$.