How do you assign a stored procedure (dynamically created) to a datastore?

We tried duplicating the code used to assign the proc to a datawindow, but we get errors. (Even tho the manual says that the datawindow and the datastore are approx. identical, with the exception of the visual/report components).

thanks in advance,