I am not sure if this works for you, but this is what I think you are looking for. The documentation suggests clearing your function if something does not work correctly, so I started with that.
In[5]:= Clear[y]
In[7]:= DSolve[{y''[x] + k y[x] == 0, y[0] == 0, y[a] == 0}, y, x]
I have no idea how to paste the output but it is a Sin function with functional limitations on the values of k.