Given $ ydx-xdy=x^2ydx$
This can be written as
$-xdy=x^2ydx-ydx$
=>$-xdy=ydx(x^2-1)$
Now seperating the variables we get,
$\large\frac{dy}{y}$$=-\bigg(\large\frac{x^2-x}{x}\bigg)$$dx$
=>$ \large\frac{dy}{y}$$=(-x+1)dx$
Integrating on both sides we get
$\int \large\frac{dy}{y}$$=\int -xdx+\int dx$
=>$\log e^y=-\large\frac{x^2}{2}$$+x+c$
$e^{\Large\frac{-x^2}{2}+x}+c=y$
$y=c\;e^{\Large\frac{-x^2}{2}+x}$