Integral solution (or a simpler) to consumer surplus - What is wrong?
Your calculation is correct. We can doublecheck your work with a graphical approach.
As shown in the figure below, $CS$ at some arbitrary and not necessarily equilibrium price $p_0$ is the gray-shaded area. If we take the non-integral approach, we get
\begin{equation}
CS=\frac12\left(\frac{A}a-p_0\right)D(p_0)=\frac12\left(\frac{A}a-p_0\right)(A-ap_0)=\frac{(A-ap_0)^2}{2a}.
\end{equation}
Differentiating with respect to $p_0$, we get
\begin{equation}
CS'=-A+ap_0.
\end{equation}