Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ExecSproc Return Object Evaluation
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
ExecSproc Return Object Evaluation
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01521806
Message ID:
01521806
Vues:
85
I wanted to find simplest way of leveraging the mm.net framework to call a SQL stored procedure that is doing data manipulation independently of simply updating/inserting/deleting via mm.net framework. (Specific example just tested successfully, after all items on an order are entered, proc must total the item costs, then apply some complicated rules to figure out shiping costs and apply various line item additional ship costs plus apply either a percentage of lump sum discount on the entire order. Oh, and don't forget the rush charges. And they ship worldwide. This is the kind of stuff SQL proc is best for in an app like this.)

I have figured out how to do it, and it works. I can put a call to ExecSproc in a partial.cs of an existing mm.net biz obj, and that lets me reference and access the ExecSproc, which then knows the default database connection info by default so I don't have to fritz with specifying the data connection and database info. See below. (FWIW, I played around but could not figure out how to reference the ExecSproc in the mmBusinessObject class i my partial.cs behind code for the web form. I imagine there are just too many other objects needed that are related, and that is why it did work in a bizobj class?)

The result returned is an object. The mm.net doc says the ExecSproc "return(s) command object allowing access to any output parameters
".

I have run the debugger through the code so I can look at all the properties on the result object returned, and I cannot find anything that lets me test whether or not the SQL proc returned reported that is executed successfully or did not. It is not returning anything, so the default return value should be 0, or a positive integer if there was an error.

I just want to be able to test whether or not at least SQL thought it executed the proc without error, otherwise, my aspx.cs code can report there was a problem.

aspx.cs behind code and the method in the PCTrans bizobj partial.cs class:
//Call SQL stored procedure to calculate shipping and amt_due.
bool retval = this.oPCTrans.CalculateShipCostsAmtDue(Session_PCTrans_ID);

public bool CalculateShipCostsAmtDue(Guid pctrans_id)
{
	object result = this.ExecSproc("usp_CalculatePCTransShipCosts",
			this.CreateParameter("@PCTRANS_ID", pctrans_id));

	return true;
}
(Hmm. I see I need to change my default signature. I am no longer with Athletics at IU, but retired March 1. This project is for a group I have supported for many years, updating their backend sales history database.)
Ronald D. Edge
Retired from Indiana University Mar 1, 2011

"You've got to be very careful if you don't know where you are going,
because you might not get there."
“When you come to the fork in the road, take it.”
--Yogi Berra
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform