Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 26th, 2003, 07:16 PM
Registered User
 
Join Date: Aug 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default C# and stored procedure

Hi,

I'm a newbie. I'm writing an application in C# and connect to SQL 2K server. How can I execute a stored procedure that needs 2 parameters and return a value back?

Thanks.

 
Old August 26th, 2003, 11:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

1_ Insert a Command in ur form.
2_ Set the CommandText to SP's name
ex: [u]Command1.CommandText = "dbo.[SP-Name]";</u>
3_ Set the CommandType to StoredProcedure;
ex: [u]this.CommGetDeputyInfo.CommandType = System.Data.CommandType.StoredProcedure;</u>
4_ Set Connection too;
ex: [u]Command1.Connection = this.NewBazConn;</u>
If u do these in Visual mode Visual Studio will ask u to insert Parameters in SP in ur Command!

HTH, let me know.

Always:),
Hovik Melkomian.





Similar Threads
Thread Thread Starter Forum Replies Last Post
stored procedure prashant_telkar SQL Server 2000 1 July 9th, 2007 07:57 AM
Stored Procedure jezywrap SQL Server ASP 1 January 3rd, 2007 12:29 AM
stored procedure kdm260 SQL Server 2000 2 June 19th, 2006 04:45 PM
Stored Procedure rajanikrishna SQL Server 2000 0 July 18th, 2005 05:01 AM
Help About Stored Procedure zhuge6 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 May 20th, 2005 09:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.