473,382 Members | 1,766 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,382 software developers and data experts.

Autogenerate Stored Procedure parameters...

Anyone know of a good way to autogenerate stored procedure parameters to put
into c# code? I don't need to do it on the fly, just while coding. I've
got some SPs with a lot of parameters, so it would save some time to be able
to make the code for the SqlParameter object automatically.
Sep 14 '06 #1
3 1919
Sorry I don't know any particular products to do it, but it sounds like
you might want to go down the code generation avenue.

Its pretty simple to write an app that connects to a database and
generates a data layer for all those sorts of things. SQLDMO lets you
expose elements of a SQL Server database in nicely typed collections.
Or you can query sysobjects yourself to get the information you need.
Not sure what the alternative is in SQL Server 2005.

Also can use products like CodeSmith (2.8 is free I think) to create
reusable code templates. Its quite user friendly and well documented.

I use such tools to create wrappers to all stored procedures and to
also create CRUD methods for tables. I then use ObjectDataBinding in
..NET2.0 to connect to those custom generated classes.

Hope this helps at all.

Regards,
Steven Nagy

Sep 14 '06 #2
Brett,

Have you worked with the Server Explorer? You can establish a
connection to your database, and then drag the stored procedure from the
explorer (under the Data Connections) to a DataSet designer and it should
create wrappers for making calls to the stored procedure.

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

"Brett Wickard" <no****@nospam.comwrote in message
news:Oq**************@TK2MSFTNGP02.phx.gbl...
Anyone know of a good way to autogenerate stored procedure parameters to
put into c# code? I don't need to do it on the fly, just while coding.
I've got some SPs with a lot of parameters, so it would save some time to
be able to make the code for the SqlParameter object automatically.

Sep 15 '06 #3
You could use the SQLCommandBuilder to get the parameters at runtime. if you
used the Enterprise library, it has all this built in to it so you just need
to parse in the parameters as a params object[] and it gets the parameters
from the db and loads them with the values. it also caches the parameters
lists so it doesnt have to query the db the second time. It doesn make this a
lot easier.

HTH

Ciaran O'Donnell

"Brett Wickard" wrote:
Anyone know of a good way to autogenerate stored procedure parameters to put
into c# code? I don't need to do it on the fly, just while coding. I've
got some SPs with a lot of parameters, so it would save some time to be able
to make the code for the SqlParameter object automatically.
Sep 15 '06 #4

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...
3
by: Michael | last post by:
This one's really got me. I have a VB.NET (version 1.1.4322) project that provides an easy way to execute stored procedures on a generic level. When I run the code on computer A (running SQL...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
8
by: Mark Flippin | last post by:
This is for a reporting problem using: Access 2000 SQL Server 2000 Both at SP3 I've a stored procedure in SQL Server 2000 which builds a result set from a disparate set of tables, utilizing...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
3
by: Bilbo | last post by:
I have a a headscratcher here: I have a form that when submitted should do 2 things when a user enters data and then clicks the Add button. Here goes: 1. Call a stored procedure called...
6
by: SandySears | last post by:
I am trying to use a stored procedure to insert a record using VS 2005, VB and SQL Server Express. The code runs without errors or exceptions, and returns the new identifer in the output...
9
by: fniles | last post by:
I am using VB.NET 2003 and SQL2000 database. I have a stored procedure called "INSERT_INTO_MYTABLE" that accepts 1 parameter (varchar(10)) and returns the identity column value from that table....
2
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.