Error on Data Upgrade from NAV2009 to NAV2015

enrickosenrickos Member Posts: 2
Hi,

I am doing an upgrade from NAV2009 to NAV2015, but on the Data Upgrade, I always get the following error (in german):

SessionId : 5124
CodeunitId : 104055
FunctionName : StartUpgrade
CompanyName : xxx
StartTime : 27.04.2016 16:16:31
Duration :
State : FailedPendingResume
Error : Fehler bei einem Aufruf von System.Data.SqlClient.SqlCommand.CommandText mit folgender Meldung: Das
Objekt mit dem Typ "System.String" kann nicht in den Typ "System.Int32" konvertiert werden.
(Error during a call to System.Data.SqlClient.SqlCommand.CommandText with the following message: the Object with the type "System.String" can not be converted in type "System. Int32".)

Any idea ?

Best regards.

Comments

  • swpoloswpolo Member Posts: 80
    Since it is impossible to use debugger in upgrade procedures to NAV2015,
    try to split upgrade to smaler steps.
    NAV2009 -> 2013
    NAV2013 ->2015

    Such errors mostly fixed as correction of data issues.
    Th most hard code in upgrade toolkit is from 2009 to 2013.

    So start NAV2009-> 2013 migration with debugger. I suppose you will catch an error.
    Nav Upgrades and DEV outsourcing
    Reports transformation to RDLC
    List -1h , Complex List -3h, Document -4h (dev hours)
    navisionupgrade.com
  • geogaringeogarin Member Posts: 2
    Hi.
    Did you find solution?
    I've same issue. I'm find it happens during this call: UpgradeDimEntry.UpgradeTable(DATABASE::"Document Dimension",0);
  • guidorobbenguidorobben Member Posts: 157
    I do know there are issues with the Upgrade if the company name starts with a Number.
  • geogaringeogarin Member Posts: 2
    Hello.
    I solve it.
    It was problem with reusing SQLCommand variable in one function.
    I fixed 3 functions in cu 104049 UpdateDimensionEntry:


    function UpdateDimSetIdInWorkTables
    ...
    // GG >>
    // Before this line SQLCommand var in use without problem .
    // But when I try to use it again, adding another query...
    //SQLCommand.CommandText := UpdateDimEntryQry;
    // After this line I'm getting error:
    // the Object with the type "System.String" can not be converted in type "System. Int32"
    //SQLCommand.ExecuteNonQuery;


    // I added new var SQLCommandUpd (same as SQLCommand)
    // and replaced code with next lines:
    SQLCommandUpd := SQLCommandUpd.SqlCommand(UpdateDimEntryQry,SQLConnection);
    SQLCommandUpd.CommandTimeout(0);
    SQLCommandUpd.ExecuteNonQuery;
    // GG <<
    ...
    function UpdateParentTable
    ...
    // GG >>
    //SQLCommand.CommandText := UpdateLedgerEntryTableQry(ParentTableID,KeyOffset,0,DestDimFieldName);
    //SQLCommand.CommandTimeout(0); // wait indefinitely for the command to finish.
    //SQLCommand.ExecuteNonQuery;

    SQLCommandUpd := SQLCommandUpd.SqlCommand(UpdateLedgerEntryTableQry(ParentTableID,KeyOffset,0,DestDimFieldName),SQLConnection);
    SQLCommandUpd.CommandTimeout(0);
    SQLCommandUpd.ExecuteNonQuery;
    // GG <<
    ...
    IF HasTableField(ParentTableID2,DestDimFieldName) AND AreDimKeyAndParentKeyCompatible(KeyOffset,ParentKeyOffset) THEN BEGIN
    // GG >>
    //SQLCommand.CommandText := UpdateLedgerEntryTableQry(ParentTableID2,KeyOffset,ParentKeyOffset,DestDimFieldName);
    //SQLCommand.ExecuteNonQuery;

    SQLCommandUpd := SQLCommandUpd.SqlCommand(UpdateLedgerEntryTableQry(ParentTableID2,KeyOffset,ParentKeyOffset,DestDimFieldName),sqlconnection);
    SQLCommandUpd.CommandTimeout(0);
    SQLCommandUpd.ExecuteNonQuery;
    // GG <<
    END ELSE
    IF NOT AreDimKeyAndParentKeyCompatible(1,0) THEN
    ERROR(STRSUBSTNO(Text001Err,DimTableID,ParentTableID2)); // TODO:ERROR(STRSUBSTNO(Text001,DimTableID,ParentTableID2),DimTableID,'');
    ...
    function CleanupTables
    ...
    // GG >>
    //SQLCommandOnClient.CommandText := TruncateDimTableQry(DimTableID);
    //SQLCommandOnClient.ExecuteNonQuery;

    SQLCommandOnClientUpd := SQLCommandOnClientUpd.SqlCommand(TruncateDimTableQry(DimTableID),SQLConnectionOnClient);
    SQLCommandOnClientUpd.CommandTimeout(0);
    SQLCommandOnClientUpd.ExecuteNonQuery;
    // GG <<
    ...
  • ara3nara3n Member Posts: 9,255
    I ran into this as well today and the above solution fixed it. Thank you.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • NimirNimir Member Posts: 7
    edited 2017-01-28
    Thanks Geogarin! You're a star! It worked like magic.
  • guidorobbenguidorobben Member Posts: 157
    Yep. This solved the problem. Ran into the same issue.
  • jarnoldjarnold Member Posts: 2
    Well done geogarin. Simple yet elegant solution that worked for me as well. I've done more upgrades than I can count that have come through NAV2015 and I've never seen this before. Very glad you were able to help us out here.
Sign In or Register to comment.