automatically determine Sproc parameters

  • Thread starter Thread starter V. Jenks
  • Start date Start date
V

V. Jenks

Picture it, Sicily, 1998, an ADO programmer could use the
Command's .Refresh method to automatically determine all
of the parameters (data types and all!) of a stored
procedure w/o having to manually code out a giant list!

Sure, it imposed a small performance hit, but sometimes
it was justified and dang convenient!

Does such a thing exist for ADO.NET? Is there ANY way to
auto-determine params w/o having to code out a huge list
every time?

I've finally gotten tired of doing this and was wondering
if there's any method or even code snippet (utility
maybe?) out there that offers this, simply to save me
some time!

Thanks!
 
You mean like the DataAdapter configuration wizard or the CommandBuilder or
the CommandBuilder.DeriveParameters?
Yes, these exist as do stored procedures within SS that these classes use,
but they don't always return the right information. Have you tried simply
dragging a sp to your form?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Yes, use the SqlCommandBuilder

SqlCommand command = new SqlCommand("usp_DoSomething", myConnection);
command.CommandType = CommandType.StoredProcedure;
SqlCommandBuilder.DeriveParameters(command)
 
Back
Top