NavigateToPrimaryKey Error


Author
Message
Rogerio Mauri
Rogerio Mauri
StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
1) PrimaryBusinessObject: tbCadastroBO1

2) browseDialog1->BusinessObjectType: vwTbCadastroBO
   browseDialog1->BusinessObjectToPopulate: vwTbCadastroBO1

3) After executed the search: Procedure executed inside of the event of closing of the browseDialog1 control.
        private void browseDialog1_BrowseDialogClosed(EventArgs e)
        {
            if (vwTbCadastroBO1.Count == 0)
                return;
            int idCadastro = vwTbCadastroBO1.IdCadastro;
            tbCadastroBO1.FillByView(vwTbCadastroBO1);
            if (tbCadastroBO1.Count > 0)
                this.NavigateToPrimaryKey(idCadastro);

        }

4) Method to populate the Primary Business Object (tbCadastroBO1) from the loaded view BO (vwTbCadastroBO1) in the browseDialog.
        public void FillByView(BDLicitecMasterViewBO.vwTbCadastroBO viewBO)
        {
            if (viewBO.Count == 0)
                return;
            viewBO.MoveFirst();
            string where = string.Empty;
            do
            {
                where += viewBO.IdCadastro + ", ";
            } while (viewBO.MoveNext());
            where = where.Trim();
            where = where.Remove(where.Length - 1);
            this.FillDataTable("SELECT * FROM TbCadastro"
             + " WHERE IdCadastro IN ( " + where + " )");

        }


5) Error: The navigation is executed successfully, however, the controls in the form is not refreshed.

Rogério Mauri Smile



Replies
Rogerio Mauri
Rogerio Mauri
StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
Trent...

Solved problem!

Step by step:

Considering that vwTbCadastroBO1 is an object constructed from a view, it does not have primary key. Then, in the "Business Object Mapper" I configured "Override Primary Key Specification" with the IdCadastro field. ... soon easy...

Of fact the problem occurred because the primary key of the BO was not defined. (the vwTbCadastroBO has its origin in one view in the database).

I wait that my English for AltaVista translator has been intelligible.

Thank you very much BigGrin BigGrin BigGrin

Rogério Mauri Smile



Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Yeah, you do have to have a primary key so that makes sense.  Glad you found the problem. Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Rogerio Mauri - 17 Years Ago
Rogerio Mauri - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Rogerio Mauri - 17 Years Ago
Trent L. Taylor - 17 Years Ago
                         Trent... Solved problem! Step by step: Considering that...
Rogerio Mauri - 17 Years Ago
                             Yeah, you do have to have a primary key so that makes sense. Glad you...
Trent L. Taylor - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search