error in the database struture. The error(1190 in module 19)

abnainasabnainas Member Posts: 174
edited 2009-10-14 in NAV Tips & Tricks
When i want to take a backup from dynamics NAV, this error appaers:
"There is an error in the database struture. The error (1190 in module 19)
may have been caused by the computer or a program.
Table: Item
Compny:
Key Fields: No."

Please advice
Ahmad Bani Naser
Dynamics NAV Developer

Comments

  • fverkelfverkel Member Posts: 66
    I have had the same errortext, once with error 1204 in module 19 and once with error 9 in module 50.
    This has helped.

    1. Make a copy of the database.
    2. Export all data from table Item.
    A simple dataport which dumps all fields except flowfields will do.
    3. Delete all records with DELETEALL(FALSE).
    4. Import the data.
    You could use the same dataport.
    Make sure that you don't use any triggers !
    Keep It Simple and Stupid (KISS), but never oversimplify.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    abnainas wrote:
    When i want to take a backup from dynamics NAV, this error appaers:
    "There is an error in the database struture. The error (1190 in module 19)
    may have been caused by the computer or a program.
    Table: Item
    Compny:
    Key Fields: No."

    Please advice

    In most cases this error comes about because you have lower case characters in a CODE field. This can happen if you directly access the database (say though ODBC) and write data without making sure its the correct data type.

    You need to figure out how the error occurred, by looking at any external connectivity you have.

    Once you find the source, you need to fix the error by simply writing Navision code that converts the code from lower case to upper case.
    David Singleton
  • amcmwuamcmwu Member Posts: 34
    Hello

    I tried to solve the problem but i still hav a question.

    Must i have a report that calculates the flowfield after
    the Dataport? :-k

    Thanks for answer and happy new year to everyone.

    Martin
  • fverkelfverkel Member Posts: 66
    Best wishes to you too, Martin.

    ???
    You don't need to calculate the flowfields.
    Since they are calculated when used, you don't want to (nor should you) export and import that data.
    Keep It Simple and Stupid (KISS), but never oversimplify.
  • amcmwuamcmwu Member Posts: 34
    one more question i have is - how can i be sure that i dont use a trigger. A standard dataport works with insert TRUE or FALSE?

    Regards Martin
  • fverkelfverkel Member Posts: 66
    Set the data-item properties AutoSave, AutoUpdate and AutoReplace to No. This way you can handle things yourself.
    Then use C/AL-code in de trigger OnAfterImportRecord: INSERT(FALSE)

    The property CallFieldValidate of the Dataport Fields is default No, which is what you want in this situation. Don't change those.

    Good luck.
    Keep It Simple and Stupid (KISS), but never oversimplify.
  • amcmwuamcmwu Member Posts: 34
    Thanks a lot to fverkel

    .. it makes me a little nervous that you wish me luck 8-[
    but i will try it.

    Regards Martin
  • BeliasBelias Member Posts: 2,998
    I encounter today the same problem and I have developed this:
    tbfield.SETRANGE(TableNo,[b]23[/b]);
    tbfield.SETRANGE(Type,tbfield.Type::Code);
    RRRec.GETTABLE([b]tbvendor[/b]);
    dlgwindow.OPEN(txcwindow);
    IF tbfield.('-') THEN BEGIN
      REPEAT
        dlgwindow.UPDATE(1,tbfield.FieldName);
        IF RRRec.('-') THEN BEGIN
          REPEAT
            FRField := RRRec.FIELD(tbfield."No.");
            IF FORMAT(FRField.VALUE) <> (UPPERCASE(FORMAT(FRField.VALUE))) THEN BEGIN
              FRField.VALUE := (UPPERCASE(FORMAT(FRField.VALUE)));
              RRRec.MODIFY;
            END;
          UNTIL RRRec.NEXT = 0;
        END;
      UNTIL tbfield.NEXT = 0;
    END;
    dlgwindow.CLOSE
    

    It's slow and only a prototype...I will explain it when I can...now I'm busy as you can imagine :mrgreen:

    Well...
    RRRec ->recordref
    FRField -> fieldref
    TBField -> table "Field"

    code in bold -> it's fixed: you must change it according to the table you want to change: in this case table 23: Vendor

    sorry...are there recref and fieldref in 2.60? I don't remember....
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • krikikriki Member, Moderator Posts: 9,094
    [Topic moved from Navision forum to Navision Tips & Tricks forum]
    The code of Belias can be useful to resolve the problem.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ara3nara3n Member Posts: 9,255
    That's great solution using recref. =D>
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • amcmwuamcmwu Member Posts: 34
    Hello Everybody

    i also find a solution of my problem. It 's a little different :) .
    I wirte a Dataport and read al data from the table. Settings in
    the Dataport were Autoupdate - No and Autoreplace - No. Then i
    tried to read the txt-file into the table and it crashes different times.
    A copy of the txt/file i opend in EXCEL and there i see that some of the
    CODE-Fields had two " CR/LF ". That were the fault and i can correct it
    directly in the Itemmask.
    Now the database is Ok. The error were because some users copy and paste complete Cells from EXCEL into the Field.

    Thanks everybody


    Martin
  • BeliasBelias Member Posts: 2,998
    Thx Ara3n :mrgreen:
    As the code is now in tips&tricks, I have to confirm you that i tested the code (used for a dozen tables) ant it works fine (slow indeed, but better than modify data in sql, writing and writing queries)...and this is the complete object
    OBJECT Codeunit 99999 Correct lowcase Codes
    {
      OBJECT-PROPERTIES
      {
        Date=23/01/08;
        Time=15.25.41;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        OnRun=BEGIN
                //In this instruction: "TBField.SETRANGE(TableNo,3)" the tableno must match the table no of the variable TBTableToFix
                //I put Code "3" because is the first table. Replace it with whatever you want
                TBField.SETRANGE(TableNo,3);
                TBField.SETRANGE(Type,TBField.Type::Code);
                RRRec.GETTABLE(TBTableToFix);
                DLGWindow.OPEN(TXCWindow);
                IF TBField.FINDSET THEN BEGIN
                  REPEAT
                    DLGWindow.UPDATE(1,TBField.FieldName);
                    IF RRRec.FINDSET THEN BEGIN
                      REPEAT
                        FRField := RRRec.FIELD(TBField."No.");
                        IF FORMAT(FRField.VALUE) <> (UPPERCASE(FORMAT(FRField.VALUE))) THEN BEGIN
                          FRField.VALUE := (UPPERCASE(FORMAT(FRField.VALUE)));
                          RRRec.MODIFY;
                        END;
                      UNTIL RRRec.NEXT = 0;
                    END;
                  UNTIL TBField.NEXT = 0;
                END;
                DLGWindow.CLOSE
              END;
    
      }
      CODE
      {
        VAR
          TBField@1130000 : Record 2000000041;
          RRRec@1130001 : RecordRef;
          FRField@1130002 : FieldRef;
          TBTableToFix@1130003 : Record 3;
          DLGWindow@1130004 : Dialog;
          TXCWindow@1130005 : TextConst 'ENU=Field #1##################################;ITA=Campo #1##################################';
    
        BEGIN
        END.
      }
    }
    
    
    
    enjoy! 8)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • mark_aumark_au Member Posts: 40
    Hi Guys,

    Thought i would dig this thread up from last year, I'm "fortunate" enough to have a database with this problem (lowercase letter in code field) due to an external tool modifying records through ODBC. I have tried using the tool below to fix the issue but it just continues to generate the same "The X Table contains a value in a Code field that cannot be used with Microsoft Dynamics NAV" error message. Is there some trick to get the tool to work that i'm missing, or is it restricted to only work in C/Side or certain versions of NAV?

    Any help would be much appreciated!
  • BeliasBelias Member Posts: 2,998
    Are you sure that the problem is lowercase in a code field and not something else? (e.g. excel CRLF?)
    The tool solves ONLY lowercase/Code problems, not "strange" characters.
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • mark_aumark_au Member Posts: 40
    Belias wrote:
    Are you sure that the problem is lowercase in a code field and not something else? (e.g. excel CRLF?)
    The tool solves ONLY lowercase/Code problems, not "strange" characters.

    I was testing with the above code in a demo database where i just modified a record using SQL Management Studio (changed the "Search Description" on an Item to include a lower case character), and was not able to get it to work, it would complain about that one record when it ran the 'UNTIL RRRec.NEXT = 0' line of code which was retrieving the broken record. So no "strange" characters were stopping it from working, it was just a lowercase value in a code field.

    I turned on the debugger and noticed that it had at least loaded the first couple of values into the RecordRef variable, however it still contained the values from the previous record in the "Search Description" field, and if my memory is correct, all other fields after the "Search Description' were from the previous record.
    :?:
Sign In or Register to comment.