|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Stored Procedure not returning multiple rows??! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|