It's been a while since I've had to explain the process of solving second order ODE's, so if anyone finds a mistake in this please do let me know
In order to solve this differential equation you would have to learn how to solve Second-Order Differential equations in general. The equation you have provided is known as a Second-Order Inhomogenous Linear Ordinary Differential Equation with Constant Coefficients.
These are of the form (Note that $q$ in this equation ONLY is not the same as your charge function q):
$$y''+py'+qy=r(x)$$
Second-Order: Involves the second derivative of $y$
Linear: It is of the form $p_0(x)\frac{d^ny}{dy^n}+p_1(x)\frac{d^{n-1}y}{dy^{n-1}}+p_2(x)\frac{d^{n-2}y}{dx^{n-2}}+...+p_ny(x)=r(x)$
Inhomogenous: $r(x) \neq 0$
Constant Coefficients: $p$ and $q$ are constants.
Your equation in this form is:
$$-Lq''+Rq'+\frac{q}{C}=-V\Rightarrow q''-\frac{R}{L}q'-\frac{1}{LC}q=\frac{V}{L}$$
To solve this we must do the proceed with the following steps:
Step 1: Finding the complementary solution
We start by solving the equivalent homogenous problem $y''+py'+qy=0$
Setting $V=0$
$$ q''-\frac{R}{L}q'-\frac{1}{LC}q=0$$
Now we need to find what is known as an auxillary equation. We consider that $q$ is of the form $e^{mt}$.
$$q=e^{mt},\,q'=me^{mt},q''=m^2e^{mt}$$
If we plug these in and rearrange, we get:
$$e^{mt}(m^2-\frac{R}{L}m-\frac{1}{LC})=0$$
Since $e^{mt}\neq0$, then $(m^2-\frac{R}{L}m-\frac{1}{LC})=0$
This is a quadratic equation with solutions:
$$m_{1,2}=\frac{\frac{R}{L}\pm\sqrt{\frac{R^2}{L^2}-\frac{4}{LC}}}{2}\Rightarrow m_1=\frac{\frac{R}{L}+\sqrt{\frac{R^2}{L^2}-\frac{4}{LC}}}{2},m_2=\frac{\frac{R}{L}-\sqrt{\frac{R^2}{L^2}-\frac{4}{LC}}}{2}$$
The discriminant of the roots $\Delta = \frac{R^2}{L^2}-\frac{4}{LC}$ causes three different cases to arise:
Case 1:$\Delta>0$, which tells us we have two distinct real roots, and in this case we get two linearly independent solutions:
$$q_1=e^{m_1t},q_2=e^{m_2t}$$
which gives us the complementary solution:
$$q_c(t)=C_1e^{m_1t}+C_2e^{m_2t}$$
Case 2:$\Delta=0$, which tells us we have a double repeated root ($m_1=m_2=m$), and in this case we get two linearly independent solutions:
$$q_1=e^{mt},q_2=te^{mt}$$
which gives us the complementary solution:
$$q_c(t)=C_1e^{mt}+C_2te^{mt}$$
Case 3:$\Delta<0$, which tells us we have a two distinct complex roots and in this case we get two linearly independent solutions:
$$q_1=e^{(a+ib)t}=e^{at}(\cos bt+i\sin bt), q_2 = e^{(a-ib)t}=e^{at}(\cos bt-i\sin bt)$$
which gives us the complementary solution:
$$q_c(t)=e^{at}[C_1(\cos bt+ i\sin bt)+C_2(\cos bt - i \sin bt)]$$
Step 2: We find the particular solution (or particular integral), and this usually is a trial-and-error approach where your decision depends on the form that $r(x)$ comes in. In our case $r(x)=V$, which is just a constant function of $t$. So we will make the guess that $q_p=A$, another constant function of $t$.
Plugging this in we get:
$$-\frac{A}{LC}=\frac{V}{L}\Rightarrow A=-CV$$
And if my knowledge of Electrical Physics is correct, I believe that $CV=Q$
Therefore,
$$q_p=-CV=-Q$$
Step 3: Now that we have our complementary and particular solutions, all we need to do is add them together to get our general solution. Hence for cases $1$ and $3$,
$$q(t)=q_c+q_p\Rightarrow q(t)=C_1e^{m_1t}+C_2e^{m_2t}-Q$$
or for case $2$,
$$q(t)=q_c+q_p\Rightarrow q(t)=C_1e^{mt}+C_2te^{mt}-Q$$
The constants $C_1,C_2$ and $Q$ can only be determined by knowing values of $q(t)$ at different times $t$, which brings two new problems in differential equations known as Initial-Value Problems and Boundary-Value Problems.
I believe in your specific equation the electrical circuit is undamped, which means $\Delta<0$ and that is how the "exponentially decreasing sine wave function arises".
Hope this gives you some insight on how to solve Second-Order ODE's.
Best Answer
I think besides being wrong or right, a result should also be useful. If you arrived at a differential equation for $i$, but have boundary value for $U_C(t)$, that is $U_C(0) = U_{C,0}$, then I wonder if this differential equation is the result you are looking for.
The convention is arbitrary as long as you stick to it.
Let's add some currents to the schematic:
The indices in the schematic are lower case for readability while in the formulas they are upper case.
As you said
$$U_C = U_R + U_L$$
additionally
$$I_C = C\dot U_C$$ $$U_L = L\dot I_{RL}$$ $$U_R = RI_{RL}$$
from the circuit it looks like $$I_C = -I_{RL}$$
which gives $$U_L = L\dot I_{RL}= L\dot I_C$$ $$U_R = RI_C$$
and with $I_C = C\dot U_C$ and $\dot I_C = C\ddot U_C$, respectively
$$U_L = L\dot I_C = LC\ddot U_C$$ $$U_R = RI_C = RC\dot U_C $$
you end up with a differential equation for $U_C$ which is what you are looking for (I guess)
$$0= LC\ddot U_C + RC\dot U_C - U_C$$
clumsy me taking over, trying to solve this
$$0= LC\lambda^2 + RC\lambda - 1$$
$$0= \lambda^2 + \frac{R}{L}\lambda - \frac{1}{LC}$$ $$\lambda_{1,2}=\frac{-RC\pm\sqrt{(RC)^2-4}}{2LC}$$
with the general solution for $U_C$ $$U_C(t) = a_1e^{\lambda_1 t} + a_2e^{\lambda_2 t}$$
interpreting the different kinds of possible $\lambda_{1,2}$
The conclusion is that no matter how the values are, $U_C(t)$ is always damped.