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 September 13th, 2004, 12:32 PM
ashleyflynn ashleyflynn is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 2 ashleyflynn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Stored Procedure not returning multiple rows??!

Hello, i am using the latest version of the DB, embedded Db & .NET provider. i have just set up 2 stored procedures, 1 that inserts a row into the a table (works no problem) and 1 that retrieves everything in the table. When i try to get everything some odd things happen. If i request using the main server i get just the first row returned, if i connect using the embedded server i get the column names with no rows returned(!) What really getting on my tits is that running the stored procedure in IB Expert works fine! Could having a column name the same as the table name be causing problems?

Here is the procedure and code;

CREATE PROCEDURE ADD_SOURCE (
SOURCEID VARCHAR(50),
SOURCE VARCHAR(50))
AS
begin
BEGIN
INSERT INTO SOURCE (SOURCEID,SOURCE)
VALUES (:SourceID,:Source);
END
suspend;
end

WRONG PROCEDURE SORRY! heres the proper one

SET TERM ^ ;

CREATE PROCEDURE GET_SOURCES
RETURNS (
SOURCEID VARCHAR(50),
SOURCE VARCHAR(50))
AS
BEGIN
FOR
SELECT Source.SourceID, Source.Source
FROM SOURCE
INTO :SOURCEID, :SOURCE
DO
SUSPEND;
END
^

SET TERM ; ^

CODE - tried 2 methods same results for both, one of them is commented out

FbTransaction myTransaction;
FbConnection myConnection = new FbConnection(connectionString);

myConnection.Open();

myTransaction = myConnection.BeginTransaction();

FbCommand myCommand = new FbCommand("EXECUTE PROCEDURE GET_SOURCES", myConnection, myTransaction);


//FbDataAdapter myDataAdapter = new FbDataAdapter("EXECUTE PROCEDURE GET_SOURCES", connectionString);
//DataSet myDataSet = new DataSet();
//myDataAdapter.Fill(myDataSet, "patients");
myCommand.CommandType = CommandType.StoredProcedure;

DataSet myDS = new DataSet();
FbDataAdapter myDataAdapter = new FbDataAdapter(myCommand);
myDataAdapter.Fill(myDS,"Sources");

myCommand.ExecuteNonQuery();

//Console.WriteLine(myCommand.Parameters[1].Value);

myTransaction.Commit();

myConnection.Close();
dataGrid1.DataSource=myDS;


Any ideas what on earth is going wrong the tables schema is;
<DB>
<TABLENAME>SOURCE</TABLENAME>
<COLUMN>SOURCEID</COLUMN>
<COLUMN>SOURCE</COLUMN>
</DB>

Many thanks for you help

Reply With Quote
  #2  
Old September 14th, 2004, 07:37 AM
ashleyflynn ashleyflynn is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 2 ashleyflynn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Resolved

The wonderful MR Carlos Guzmán Ãlvarez on the firebird-net-provider@lists.sourceforge.net list solved this changing;

FbCommand myCommand = new FbCommand("EXECUTE PROCEDURE GET_SOURCES",
>myConnection, myTransaction);

to this:

FbCommand myCommand = new FbCommand("GET_SOURCES", myConnection, myTransaction);

Works no problems

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Stored Procedure not returning multiple rows??!


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


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