Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To 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 September 3rd, 2007, 06:47 AM
Registered User
 
Join Date: Aug 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB & SQL stored procedure

HI,:)

My Stored procedure inserts (OR DO NOT) user data to the database based on some conditions.

How can I inform VB.NET code of the "stored procedure's execution results" to inform the web form (I mean user)?

The Data inserted OR not inserted, this is the problem, says the code :D(asks user I mean). I tried ExecuteNonQuery, but it couldn't do that.

THANKS



 
Old September 4th, 2007, 11:08 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Create a command object
Make it stored procedure
Set the name of the procedure
Create a parameter for each parameter of the stored procedure. Give these parameters a name for ease of access later.
Add the parameter from above. Repeat for each param.
.Execute the command
All IN/OUT or OUT parameters will now hold the value they were set to within the stored procedure.

You also can convert your procedure to a function, and return a code you devise as an indicator of what happened during execution.

You can raise an error within your procedure with text explaining what happened. When the error gets raised, read the results and ignore these raised errors that are actually intended as communication.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dataset & Stored Procedure Problem clioz BOOK: Professional Crystal Reports for VS.NET 0 July 21st, 2006 07:42 PM
Parameterized CRystal report & Stored procedure jay4ever_2000 ASP.NET 1.0 and 1.1 Professional 3 June 6th, 2006 08:53 AM
ASP.NET & SQL Server 2K Stored Procedure kwilliams ASP.NET 2.0 Basics 7 May 10th, 2006 12:55 AM
Location of Stored Procedure & Function in MySQL kasie MySQL 8 March 22nd, 2005 10:54 AM
SQL Stored Procedure & VB6 acdsky VB Databases Basics 1 September 29th, 2004 10:01 AM





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