Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 14th, 2007, 03:37 PM
LinXG LinXG is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 5 LinXG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 17 m 9 sec
Reputation Power: 0
New to Firebird stored procedures - help needed

I am just starting to use stored procedures with VB.Net.

I have a SP that returns a value but I do not know how to retrieve it.

Here is the SP

Quote:
SET TERM ^ ;

CREATE PROCEDURE PROCEDURE_02 (
job_class varchar(2))
returns (
my_comment varchar(50))
as
begin
/* Procedure Text */
SELECT COMMENT FROM TEST WHERE JOB_CLASS = :job_class INTO :my_comment;
end^

SET TERM ; ^


This is the code I have so far...

myCommand = New FbCommand("PROCEDURE_02", myConnection)
myCommand.CommandType = CommandType.StoredProcedure

myCommand.Parameters.Add("@JOB_CLASS", "XY") ' Return comment for "XY"


How do I determine the value for my_comment?

Reply With Quote
  #2  
Old December 14th, 2007, 08:26 PM
LyonHaert's Avatar
LyonHaert LyonHaert is offline
Arcane Scribbler
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2005
Location: Indianapolis, IN
Posts: 1,850 LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 11 h 9 m 27 sec
Reputation Power: 524
Calling ExecuteScalar() on the myCommand may work, but I'm fairly certain the following will:

1. Add another parameter for "@my_comment".
2. Set that parameter's Direction property to ParameterDirection.Output.
3. Call ExecuteNonQuery() on myCommand.
4. Retrieve the Value that has now been put in that parameter.

Here's a good site.
Comments on this post
pabloj agrees!
__________________
Joel B Fant
"An element of conflict in any discussion is a very good thing. Shows everybody's taking part, nobody left out. I like that."

.NET Must-Haves
Tools: Reflector
References: Threading in .NET

Reply With Quote
  #3  
Old December 14th, 2007, 11:29 PM
LinXG LinXG is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 5 LinXG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 17 m 9 sec
Reputation Power: 0
Hi LyonHaert;

Thanks for getting me started but I really need lots of information or a good tutorial. I figured out how to get parameter information into a stored procedure. The site you suggested confirmd that I was doing it right.

Here are some comments/questions from your post. Perhaps you or others can share your knowledge.

1. Add another parameter for "@my_comment".

What is the syntax, this

myCommand.Parameters.Add("@my_comment")

or something else?


2. Set that parameter's Direction property to ParameterDirection.Output.

How exactly do you do this? I can find no information on this anywhere. I've searched high and low for information/tutorial on using the net porvider and have turned up next to nothing.

3. Call ExecuteNonQuery() on myCommand.

No problems here.

4. Retrieve the Value that has now been put in that parameter.

Once again, how do you do this?

Is there any information anywhere that explains how to do this stuff?


Thanks for the help.
Lin

Reply With Quote
  #4  
Old December 15th, 2007, 12:35 PM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 8,073 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 4 Weeks 4 h 19 m 37 sec
Reputation Power: 281
See the sticky thread on top of this forum, lots of resources, even Firebird and .Net specific (but in this case any tutorial about .net and stored procs should do)

Reply With Quote
  #5  
Old December 15th, 2007, 08:27 PM
LinXG LinXG is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 5 LinXG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 17 m 9 sec
Reputation Power: 0
Hi pabloj

Thanks for taking the time to respond but I am beginning to feel like a sinking ship.

but in this case any tutorial about .net and stored procs should do

I've been following links for days and generally feeling overwhelmed by it all.

Is there a tutorial anywhere that you can name or point me to that shows in simple language how to use the Firebird net provider with VB.Net to.....

1) Send parameter values to a stored procedure. I mostly have this one figured out but additional information wouldn't hurt.

2) How to retrieve and use values returned as parameters from a stored procedure.

3) How to retrieve and use values where multiple rows are returned.

4) Anything else that I may have missed.


Thanks
Lin

Reply With Quote
  #6  
Old December 16th, 2007, 12:16 PM
LyonHaert's Avatar
LyonHaert LyonHaert is offline
Arcane Scribbler
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2005
Location: Indianapolis, IN
Posts: 1,850 LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level)LyonHaert User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 11 h 9 m 27 sec
Reputation Power: 524
Regarding your questions about the Direction property and retrieving the value, there is more code in the comments of the page I linked which show this.

Reply With Quote
  #7  
Old December 16th, 2007, 01:10 PM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 8,073 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 4 Weeks 4 h 19 m 37 sec
Reputation Power: 281
LinXG, please consider that people here do take the time to think before posting and expect readers to do the same, in this case read the article(s) linked.
LyonHaert pointed you to a page which shows you how to solve your problems 1) and 2), then, the same site (or Google) have the answer for question 3), see here .
Of course 4) is a bit generic and unlikely to get a quick answer

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > New to Firebird stored procedures - help needed


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT