Issue Details (XML | Word | Printable)

Key: DNET-263
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Jiri Cincura
Reporter: Pham Huu Le Quoc Phuc
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
.NET Data provider

System.FormatException is thown when call FirebirdSql.Data.FirebirdClient.FbCommandBuilder.DeriveParameters

Created: 19/Aug/09 11:37 PM   Updated: 23/Feb/11 04:11 PM
Component/s: ADO.NET Provider
Affects Version/s: 2.5.0
Fix Version/s: 2.6.5

Environment: FB 2.1.3


 Description  « Hide
Csla.DataPortalException: DataPortal.Update failed (System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at System.Data.XSDSchema.HandleElementColumn(XmlSchemaElement elem, DataTable table, Boolean isBase)
   at System.Data.XSDSchema.HandleParticle(XmlSchemaParticle pt, DataTable table, ArrayList tableChildren, Boolean isBase)
   at System.Data.XSDSchema.HandleComplexType(XmlSchemaComplexType ct, DataTable table, ArrayList tableChildren, Boolean isNillable)
   at System.Data.XSDSchema.InstantiateTable(XmlSchemaElement node, XmlSchemaComplexType typeNode, Boolean isRef)
   at System.Data.XSDSchema.HandleTable(XmlSchemaElement node)
   at System.Data.XSDSchema.HandleDataSet(XmlSchemaElement node, Boolean isNewDataSet)
   at System.Data.XSDSchema.LoadSchema(XmlSchemaSet schemaSet, DataSet ds)
   at System.Data.DataSet.ReadXSDSchema(XmlReader reader, Boolean denyResolving)
   at System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving)
   at System.Data.DataSet.ReadXml(Stream stream)
   at FirebirdSql.Data.Schema.FbSchemaFactory.GetSchema(FbConnection connection, String collectionName, String[] restrictions)
   at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.GetSchema(String collectionName, String[] restrictions)
   at FirebirdSql.Data.FirebirdClient.FbConnection.GetSchema(String collectionName, String[] restrictions)
   at FirebirdSql.Data.FirebirdClient.FbConnection.GetSchema(String collectionName)
   at FirebirdSql.Data.FirebirdClient.FbCommandBuilder.DeriveParameters(FbCommand command)

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jiri Cincura made changes - 30/Aug/09 05:35 AM
Field Original Value New Value
Security Developers [ 10012 ]
Jiri Cincura added a comment - 30/Aug/09 05:57 AM
Do you have any particular case when it fails? I'm not able to reproduce it with basic SP.

Jiri Cincura made changes - 30/Aug/09 06:22 AM
Status Open [ 1 ] In Progress [ 3 ]
Pham Huu Le Quoc Phuc added a comment - 31/Aug/09 07:03 AM
Sorry, my english not well. This exception is thown only some machine(Windows XP SP2), then when I create a new Windows user(on Windows), exception not happened. I think it fails because Windows User change user's windows Settings(Decimal Symbol, Digit Group Symbol, ..)

Jiri Cincura added a comment - 05/Sep/09 01:58 AM
OK, then I need the DDL for the procedure and what locale has been set in system.

Pham Huu Le Quoc Phuc added a comment - 05/Sep/09 04:20 AM
This exception is thown only some machine when I install for customers. And I can't know what locate has been changed in Windows Settings.
if exception is happened, all procedures are same problem. I think it not depend on procedure code.

But I send a example procedure here:
CREATE OR ALTER PROCEDURE RPT_SO_CAI_CHUNG_TU_GHI_SO(
    P_LANGUAGE TYPE OF DM_SMALLINT,
    P_COMPANY TYPE OF DM_ID,
    P_ID TYPE OF DM_ID,
    P_ACCOUNT TYPE OF DM_ID,
    P_TU_NGAY TYPE OF DM_DATE,
    P_DEN_NGAY TYPE OF DM_DATE)
RETURNS (
    CODE TYPE OF DM_DOCUMENT_CODE,
    INPUT_DATE TYPE OF DM_DATE,
    CONTENT TYPE OF DM_ENTRY_CONTENT,
    ACCOUNT_CODE TYPE OF DM_CODE,
    BEGINNING_DEBIT TYPE OF DM_DOUBLE,
    BEGINNING_CREDIT TYPE OF DM_DOUBLE,
    RISING_DEBIT TYPE OF DM_DOUBLE,
    RISING_CREDIT TYPE OF DM_DOUBLE,
    ENDING_DEBIT TYPE OF DM_DOUBLE,
    ENDING_CREDIT TYPE OF DM_DOUBLE,
    NOTE TYPE OF DM_NOTE)
AS
DECLARE VARIABLE PARENT_ACCOUNT_CODE TYPE OF DM_CODE;
DECLARE VARIABLE DEBIT_ACCOUNT_CODE TYPE OF DM_CODE;
DECLARE VARIABLE CREDIT_ACCOUNT_CODE TYPE OF DM_CODE;
DECLARE VARIABLE OFFICIAL_SUM_OF_MONEY TYPE OF DM_DOUBLE;
DECLARE VARIABLE SUM_RISING_DEBIT TYPE OF DM_DOUBLE;
DECLARE VARIABLE SUM_RISING_CREDIT TYPE OF DM_DOUBLE;
DECLARE VARIABLE HAS_VALUE TYPE OF DM_BOOL;
BEGIN
    HAS_VALUE = 0;

    SELECT CODE
    FROM ATOMS
    WHERE ATOMS.COMPANY = :P_COMPANY AND ATOMS.ID = :P_ACCOUNT
    INTO :PARENT_ACCOUNT_CODE;

    SELECT DEBIT, CREDIT
    FROM INT_SD_1_TK_DN_C(:P_COMPANY, :PARENT_ACCOUNT_CODE, :P_TU_NGAY)
    INTO :BEGINNING_DEBIT, :BEGINNING_CREDIT;

    SUM_RISING_DEBIT = 0;
    SUM_RISING_CREDIT = 0;

    FOR
        SELECT RECORDED_DOCUMENTS.CODE, INPUT_DATE, RECORDED_DOCUMENT_ENTRIES.CONTENT, DEBIT_ATOM.CODE, CREDIT_ATOM.CODE, SUM_OF_MONEY, PROTON_STRINGS.NOTE
        FROM RECORDED_DOCUMENTS
        JOIN RECORDED_DOCUMENT_ENTRIES ON RECORDED_DOCUMENT_ENTRIES.COMPANY = :P_COMPANY AND RECORDED_DOCUMENT_ENTRIES.RECORDED_DOCUMENT = RECORDED_DOCUMENTS.ID
        JOIN ACCOUNTS DEBIT_ACCOUNT ON DEBIT_ACCOUNT.COMPANY = :P_COMPANY AND DEBIT_ACCOUNT.ID = RECORDED_DOCUMENT_ENTRIES.DEBIT_ACCOUNT
        JOIN ATOMS DEBIT_ATOM ON DEBIT_ATOM.COMPANY = :P_COMPANY AND DEBIT_ATOM.ID = DEBIT_ACCOUNT.ID
        JOIN ACCOUNTS CREDIT_ACCOUNT ON CREDIT_ACCOUNT.COMPANY = :P_COMPANY AND CREDIT_ACCOUNT.ID = RECORDED_DOCUMENT_ENTRIES.CREDIT_ACCOUNT
        JOIN ATOMS CREDIT_ATOM ON CREDIT_ATOM.COMPANY = :P_COMPANY AND CREDIT_ATOM.ID = CREDIT_ACCOUNT.ID
        JOIN PROTON_STRINGS ON PROTON_STRINGS.COMPANY = :P_COMPANY AND PROTON_STRINGS.LANGUAGE = :P_LANGUAGE AND PROTON_STRINGS.ID = RECORDED_DOCUMENT_ENTRIES.ID
        WHERE RECORDED_DOCUMENTS.COMPANY = :P_COMPANY AND RECORDED_DOCUMENTS.INPUT_DATE BETWEEN :P_TU_NGAY AND :P_DEN_NGAY AND
        (DEBIT_ATOM.CODE STARTING WITH :PARENT_ACCOUNT_CODE OR CREDIT_ATOM.CODE STARTING WITH :PARENT_ACCOUNT_CODE)
        ORDER BY INPUT_DATE, RECORDED_DOCUMENTS.CODE, DEBIT_ATOM.CODE, CREDIT_ATOM.CODE
        INTO :CODE, :INPUT_DATE, :CONTENT, :DEBIT_ACCOUNT_CODE, :CREDIT_ACCOUNT_CODE, :OFFICIAL_SUM_OF_MONEY, :NOTE
    DO
    BEGIN
        IF(DEBIT_ACCOUNT_CODE STARTING WITH PARENT_ACCOUNT_CODE)THEN
        BEGIN
            ACCOUNT_CODE = CREDIT_ACCOUNT_CODE;
            RISING_DEBIT = OFFICIAL_SUM_OF_MONEY;
            RISING_CREDIT = NULL;

            SUM_RISING_DEBIT = SUM_RISING_DEBIT + RISING_DEBIT;

            ENDING_DEBIT = BEGINNING_DEBIT - BEGINNING_CREDIT + SUM_RISING_DEBIT - SUM_RISING_CREDIT;
            IF(ENDING_DEBIT > 0)THEN
                ENDING_CREDIT = 0;
            ELSE
            BEGIN
                ENDING_CREDIT = ABS(ENDING_DEBIT);
                ENDING_DEBIT = 0;
            END

            SUSPEND;

            HAS_VALUE = 1;
        END

        IF(CREDIT_ACCOUNT_CODE STARTING WITH PARENT_ACCOUNT_CODE)THEN
        BEGIN
            ACCOUNT_CODE = DEBIT_ACCOUNT_CODE;
            RISING_DEBIT = NULL;
            RISING_CREDIT = OFFICIAL_SUM_OF_MONEY;

            SUM_RISING_CREDIT = SUM_RISING_CREDIT + RISING_CREDIT;

            ENDING_DEBIT = BEGINNING_DEBIT - BEGINNING_CREDIT + SUM_RISING_DEBIT - SUM_RISING_CREDIT;
            IF(ENDING_DEBIT > 0)THEN
                ENDING_CREDIT = 0;
            ELSE
            BEGIN
                ENDING_CREDIT = ABS(ENDING_DEBIT);
                ENDING_DEBIT = 0;
            END

            SUSPEND;

            HAS_VALUE = 1;
        END
    END

    IF(HAS_VALUE = 0)THEN
    BEGIN
        ENDING_DEBIT = BEGINNING_DEBIT;
        ENDING_CREDIT = BEGINNING_CREDIT;

        SELECT CONTENT
        FROM TEXTS
        WHERE TEXTS.ID = 1 AND TEXTS.LANGUAGE = :P_LANGUAGE
        INTO :CONTENT;

        SUSPEND;
    END
END

Jiri Cincura added a comment - 03/Oct/09 01:52 AM
If I don't know what locale is set, I cannot test the problem and fix it.

Jiri Cincura made changes - 03/Oct/09 01:52 AM
Resolution Incomplete [ 4 ]
Status In Progress [ 3 ] Closed [ 6 ]
Pham Huu Le Quoc Phuc added a comment - 22/Feb/11 08:29 AM
In Windows XP SP3, .Net 2.0, you do:
1. Change settings in Windows XP, see picture: http://tonyvn.com/abc/DriveParameterException.png
2. Test case: call DeriveParameters and exception is throw: System.FormatException: Input string was not in a correct format.

Pham Huu Le Quoc Phuc added a comment - 22/Feb/11 08:35 AM
In step 1, you can change Negative sign symbol: from - to ',' or '@' or '~'
The same exception is throw

Jiri Cincura made changes - 23/Feb/11 02:03 PM
Resolution Incomplete [ 4 ]
Status Closed [ 6 ] Reopened [ 4 ]
Jiri Cincura added a comment - 23/Feb/11 04:11 PM
rev.52450

Jiri Cincura made changes - 23/Feb/11 04:11 PM
Status Reopened [ 4 ] Resolved [ 5 ]
Fix Version/s 2.6.1 [ 10400 ]
Resolution Fixed [ 1 ]