473,326 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Reflection on Stored Procedure

I want to load into a SqlCommand objet an existing stored
procedure. I know that by using the Parameters collection
I can add parameters, but how can I retrieve the
parameters already defined from the SP? I would like by a
reflection-like mechanisms be able to get the parameters
declared into the SP.

Strangely, if you're using the Server Explorer and you
drag a stored procedure on your page, inside the
automatic generated code the parameters will be set
correctly. But since I want to use a dynamic mechanism to
load a stored and retrieve its parameters, I can't choose
in advance a stored procedure and drag it on my page.

Gandalf says hi.

Thank you for any help,
Aragorn
Nov 15 '05 #1
2 2883
Aragorn,

I believe that you can get the parameters by using the sp_sproc_columns
stored procedure. It will return a result set with the parameters for the
stored procedure. You will have to do a little filtering, but it will give
you all the information you want.

What is returned is shown in the documentation for the sp_sproc_columns
procedure.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Aragorn" <ar*****@lotr3.com> wrote in message
news:06****************************@phx.gbl...
I want to load into a SqlCommand objet an existing stored
procedure. I know that by using the Parameters collection
I can add parameters, but how can I retrieve the
parameters already defined from the SP? I would like by a
reflection-like mechanisms be able to get the parameters
declared into the SP.

Strangely, if you're using the Server Explorer and you
drag a stored procedure on your page, inside the
automatic generated code the parameters will be set
correctly. But since I want to use a dynamic mechanism to
load a stored and retrieve its parameters, I can't choose
in advance a stored procedure and drag it on my page.

Gandalf says hi.

Thank you for any help,
Aragorn

Nov 15 '05 #2
Hi,

After a quick test, it seems that I will be able to
retrieve the parameters associated to my stored proc.
Thank you: you made my day!

Regards,
A
-----Original Message-----
Aragorn,

I believe that you can get the parameters by using the sp_sproc_columnsstored procedure. It will return a result set with the parameters for thestored procedure. You will have to do a little filtering, but it will giveyou all the information you want.

What is returned is shown in the documentation for the sp_sproc_columnsprocedure.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Aragorn" <ar*****@lotr3.com> wrote in message
news:06****************************@phx.gbl...
I want to load into a SqlCommand objet an existing stored procedure. I know that by using the Parameters collection I can add parameters, but how can I retrieve the
parameters already defined from the SP? I would like by a reflection-like mechanisms be able to get the parameters declared into the SP.

Strangely, if you're using the Server Explorer and you
drag a stored procedure on your page, inside the
automatic generated code the parameters will be set
correctly. But since I want to use a dynamic mechanism to load a stored and retrieve its parameters, I can't choose in advance a stored procedure and drag it on my page.

Gandalf says hi.

Thank you for any help,
Aragorn

.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
5
by: Frazer | last post by:
hi could any one tell me which real life senarios reflection can be used in ? thnx
4
by: Rhino | last post by:
Is it possible for a Java Stored Procedure in DB2 V7.2 (Windows) to pass a Throwable back to the calling program as an OUT parameter? If yes, what datatype should I use when registering the...
8
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
1
by: Harish Krishnan | last post by:
..NET Assembly CustomerInfo.dll has a class by name CustomerInfo which inturn has two methods GetCustomer() and GetCustomerDetails() and GetCustomer() calls GetCustomerDetails()....
0
by: Harish Krishnan | last post by:
..NET Assembly CustomerInfo.dll has a class by name CustomerInfo which inturn has two methods GetCustomer() and GetCustomerDetails() and GetCustomer() calls GetCustomerDetails()....
1
by: Harish Krishnan | last post by:
..NET Assembly CustomerInfo.dll has a class by name CustomerInfo which inturn has two methods GetCustomer() and GetCustomerDetails() and GetCustomer() calls GetCustomerDetails()....
3
by: Tod Birdsall | last post by:
Hi, My boss has asked me to create a tool that can give us a list of stored procedure names that are being called from each of our app's web pages. This is an ASP.NET application that is rather...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.