Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I programmatically change/add a stored procedure at runtime

Status
Not open for further replies.

johnatwork

Programmer
Oct 12, 2003
3
US
I've seen examples of how to programmatically add or change a table at runtime w/ RAS 9 object model, but not a SQL Server stored procedure. Is it possible?

I'd like to change the stored procedure used at runtime, like you would do with Database/Set Datasource Location within the Crystal designer.

If it's not possible with RAS 9, is it possible with RDC object model?
 
In the RDC, yes. It's exactly like changing the tablename when the table is a real table. You use the SetTableLocation method of the DatabaseTable object, as in:

strLocation = "Northwind.green.sp_International_Customer_Orders"

crTable.SetTableLocation strLocation, "", ""

Of course, the schema of the data returned by the new stored procedure has to be the same as that returned by the original stored proc. Otherwise, the report won't process correctly (or at all).

As for RAS, I would assume so, because you also have a SetTableLocation method for the DatabaseController object. Whatever the sample you've seen looks like for changing a table should work equally well for a stored proc.
 
Thanks, got it to work using RAS DatabaseController.SetTableLocation method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top