Storedprocedure parameters order/sequence mismatch
--------------------------------------------------

                 Key: DNET-148
                 URL: http://tracker.firebirdsql.org/browse/DNET-148
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 2.5.0 Alpha 1
         Environment: XPSP2, VS2008, Firebird-2.1.0.17176-0_Win32
            Reporter: Tang ZhiGuo
            Assignee: Carlos Guzman Alvarez


Please refer to followed example:

========================================================
In database:
CREATE PROCEDURE TEST_UPDATE (
    PARA_1 BIGINT,
    PARA_2 VARCHAR,
    PARA_3 BLOB SUB_TYPE 1 SEGMENT SIZE 100)
AS
BEGIN
  UPDATE TEST_TABLE
  SET FIELD_2 = :PARA_2
      FIELD_3 = :PARA_3
  WHERE FIELD_1 = :PARA_1;
END;

In C#:
FbCommand command = new FbCommand("TEST_UPDATE", dbConn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@PARA_2", FbDbType.VarChar);
command.Parameters.Add("@PARA_3", FbDbType.VarChar);
command.Parameters.Add("@PARA_1", FbDbType.BigInt);
command.Parameters["@PARA_2"].Value = "some string";
command.Parameters["@PARA_3"].Value = "some string";
command.Parameters["@PARA_1"].Value = 1;
command.ExecuteNonQuery();
========================================================

Above example will throw the exception "Can't cast object type of Int32 to type 
of System.String.".
I study the source code of "Firebird .Net Data Provider Version 2.5.0 Alpha 1 
for .NET 2.0", the reason is:
In "UpdateParameterValues()" of "FbCommand.cs", the sequence of parameters in 
"this.namedParameters" and "this.statement.Parameters" is mismatched.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to