I'm trying to prove the following statement: All open sets in the spectrum $X=\operatorname{Spec}(A)$ of a Dedekind domain $A$ are affine. Since all open sets are cofinite, my idea is to prove that an open set of the form $X-\mathfrak{p}$ is affine, and then use induction.
I've found this question, which explains the condition for all open sets to be principal. In particular, if $\mathfrak{p}$ is of finite order in the ideal class group, then $\mathfrak{p}^n=(f)$, $X-\mathfrak{p}=D_f$ is principal; if however $\mathfrak{p}$ is of infinite order, then $X-\mathfrak{p}$ is not principal. In this latter case, what is the coordinate ring? And how to prove that it is affine?
Thanks.
Let $I = (f,g)$ be an ideal of $A$ and let $U = X - V(I)$. Then it is pretty easy to see that $f,g \in A \subset \mathcal O_X(U) = \mathcal O_U(U) = A_f \cap A_g =: B$ satisfy the conditions of Exercise II.2.17 in Hartshorne:
1) $(f,g)B=B$, because you can check this locally and locally its certainly true.
2) $U_f$ and $U_g$ are affine, because they are equal to $D(f)$ and $D(g)$ respectively.