In this paper, boundary value problems of fractional order are converted into an optimal control problems. Then an approximate solution is constructed from translations and dilations of a B-spline function such that the exact boundary conditions are satisfied. The fractional differential operators are taken in the Riemann-Liouville and Caputo sense. Several example are given and the optimal err...