Scott Kuhl

Warning: I may have no idea what I am talking about!
posts - 765, comments - 854, trackbacks - 350

My Links

News


Help CMTA!

Twitter







Tag Cloud

Archives

Post Categories

Image Galleries

Getting Started with SubSonic - Part 20, Stored Procedures

Some tasks are just too complicated for dynamic query building and/or require a greater level of control.  To handle this, SubSonic supports stored procedures.  Each stored procedure will produce an equivalent static method in the class defined in the configuration file.  By default this is SPs.  Each method will have one parameter for each stored procedure parameter and return a StoredProcedure object.

SubSonic.StoredProcedure sp = SPs.CustOrderHist(customerID);

The stored procedure can then either call Execute, ExecuteScalar, GetDataSet or GetReader to execute and return the data.

GridView1.DataSource = sp.GetReader();

Or combining the two statements into one:

GridView1.DataSource = SPs.CustOrderHist(customerID).GetReader();

You can also work with the QueryCommand by referencing the Command property.

Find the entire series of posts here.

Print | posted on Friday, December 08, 2006 2:03 PM | Filed Under [ SubSonic ]

Feedback

Gravatar

# re: Getting Started with SubSonic - Part 20, Stored Procedures

Hi there, thanks for this although can you provide an example of the following

SubSonic.Schema.StoredProcedure sp = new SubSonic.Schema.StoredProcedure(..., DataService.GetInstance("MySqlDataProvider"))

reason being is that I have existing code that passes in a second parameter that's causing a problem,
Thanks,
3/16/2010 3:41 AM | James Radford, Web Developer
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: