Hello

I'm using .NET 1.1, FB Providor 1.7a, and Firebird 1.5.2.

I keep getting the following error when i try run a simple stored proc to insert a record:

Message:
Input string was not in a correct format.

Stack:
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.Int32.Parse(String s, NumberStyles style, IFormatProvider provider)
   at System.Convert.ToInt32(String value, IFormatProvider provider)
   at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
   at System.Convert.ToInt32(Object value, IFormatProvider provider)
   at FirebirdSql.Data.Common.DbValue.GetInt32()
   at FirebirdSql.Data.Gds.XdrStream.Write(DbField param)
   at FirebirdSql.Data.Gds.XdrStream.Write(Descriptor descriptor)
   at FirebirdSql.Data.Gds.GdsStatement.Execute()
   at FirebirdSql.Data.Firebird.FbCommand.ExecuteCommand(CommandBehavior behavior, Boolean returnsSet)
   at FirebirdSql.Data.Firebird.FbCommand.ExecuteCommand(CommandBehavior behavior)
   at FirebirdSql.Data.Firebird.FbCommand.ExecuteScalar()
  etc.

The stored proc. is:

CREATE PROCEDURE INDEXTINSERT (
    FK_CURRENCYID INTEGER,
    CODE VARCHAR(15),
    NAME VARCHAR(50),
    ISPERCENTAGE SMALLINT)
RETURNS (
    ID INTEGER)
AS
BEGIN
    ID = GEN_ID(GEN_INDEXT_ID,1);
    INSERT INTO INDEXT (INDEXTID, FK_CURRENCYID, CODE, NAME, ISPERCENTAGE)
    VALUES (:ID, :FK_CURRENCYID, :CODE, :NAME, :ISPERCENTAGE);
  SUSPEND;
END

And the method is (one of the many variations which throws the error, I originally was using datasets, the Firebird Enterprise Application Block, tried this to establish where the problem was...)

FbConnection conn = new FbConnection(connectionString);
            FbCommand com = new FbCommand("IndexTInsert", conn);
            com.CommandType = CommandType.StoredProcedure;
            FbParameter param;
            param = new FbParameter("@Name", FbDbType.VarChar);
            param.Value = name;
            com.Parameters.Add(param);

            param = new FbParameter("@Code", FbDbType.VarChar);
            param.Value = code;
            com.Parameters.Add(param);

            param = new FbParameter("@FK_CurrencyID", FbDbType.Integer);
            param.Value = currencyID;
            com.Parameters.Add(param);

            param = new FbParameter("@IsPercentage", FbDbType.SmallInt);
            param.Value = isPercentage;
            com.Parameters.Add(param);

            param = new FbParameter("@ID", FbDbType.VarChar);
            param.Direction = ParameterDirection.Output;
            com.Parameters.Add(param);
            int i =0;
            conn.Open();
            i = (int)com.ExecuteScalar();
etc.

I've tried various combinations of adapters, ExecuteNonQuery, etc. but the error is always thrown. I've been using similar methods with no problems at all, and am at a loss! The stored proc works through IBExpert (and returns an integer, the id field inserted).

Anyone got any ideas? I'd be eternally grateful :-)

Ben

Reply via email to