[dba-VB] Parameter objects in C# and ADO.

jwcolby jwcolby at colbyconsulting.com
Fri Nov 27 09:17:22 CST 2009


Over the last year or so I have built up an arsenal of stored procedures which form a system for 
performing big picture tasks.  A set of SPs create a set of temp tables, move data into them, index 
them, the export chunks into large CSV files for address validation.  Similar functionality on the 
way back in, create a chunk temp table, import the data from a CSV file, copy to a big temp table, 
create indexes on them, update hash codes and address valid flags, create more indexes on those 
fields etc.

To this point I have executed these stored procedures from an Access database, simply because I 
could write Access VBA, however VBA is less than ideal for this functionality, not to mention that I 
had no ability to get data back from the SP.  Thus the SP had to write to a log file which I could 
then read from Access.  Again, less than ideal.

Now that I am (slooooowwwwly) coming up to speed on C#, I have embarked on rewriting all of that 
control logic into C#.  Once I figure out how to read back parameters from the SP so that I can see 
things like RecordsAffected, error numbers and messages etc. I will have made a giant step forward 
in fine grained control of my big picture processes.

While I am at it I have to modify the stored procedures to pass back things like recordcount 
affected, error codes etc.  Since I could not (did not know how to) get at them from VBA I hadn't 
bothered to add that kind of stuff to the SPs.


John W. Colby
www.ColbyConsulting.com


Mark Breen wrote:
> Hello Gustav,
> 
> I presume they are not costly in terms of resources, and in fact, I would
> not dream of re-using a param for two different purposes.
> 
> I think my delight was just that I never know you could share directions.
> 
> I can imagine that Mr Colby will find a use for a standard piece of his
> arsenal to have a in-out param and once he does, he will wonder how we ever
> existing without utilising that aspect of params.
> 
> Perhaps lastupdated as a field would be an appropriate use, where the last
> updated value is passed in to the sproc, and then passed back again with the
> new value after an update has been made, after checking for concurrency
> errors first.
> 
> Thanks
> 
> Mark




More information about the dba-VB mailing list