?
Solved

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

Posted on 2005-04-04
2
Medium Priority
?
2,709 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
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

571 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