?
Solved

C# - Firebird - Returning multiple values from a stored procedure

Posted on 2005-04-04
2
Medium Priority
?
2,630 Views
Last Modified: 2012-05-05
How is it possible to return multiple values from a stored procedure with output parameters?

I use the firebird .NET provider to query?

Can you show me the C# code and the stored procedure code?

mfg maZe
0
Comment
Question by:maZe84
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Author Comment

by:maZe84
ID: 13701587
The answer is:

The SQL code is:
CREATE PROCEDURE "COUNTTO10"
RETURNS
(
  "CNT" INTEGER
)
AS
BEGIN
  Cnt = 1 ;
  WHILE ( Cnt <= 10 ) DO BEGIN
    SUSPEND ;
    Cnt = Cnt + 1 ;
  END
END ^
SET TERM ; ^

################################
the C# code is:

FbCommand cmd2 = new FbCommand();
 cmd2.Connection = con;
 cmd2.CommandType = CommandType.StoredProcedure;
 cmd2.CommandText = "SELECT * FROM \"SP_COUNTTO10\";";

con.Open();
FbDataReader reader = cmd2.ExecuteReader();
con.Close();

// This works
while (reader.Read())
{
      Console.WriteLine(reader.GetValue(0).ToString());
}
reader.Close();
0
 
LVL 2

Accepted Solution

by:
Lunchy earned 0 total points
ID: 13702596
Closed, 20 points refunded.
Lunchy
Friendly Neighbourhood Community Support Admin
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question