In a Trial Version How Can I Fill the B.O.?


Author
Message
Marcio Valerio Silva
Marcio Valerio Silva
StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)StrataFrame Novice (115 reputation)
Group: Forum Members
Posts: 55, Visits: 929
In a Trial Version How Can I Fill the Business Objects?

The Method FillTop100() showing in on-line Demo  isn´t presente here!



Is it possible fill it with another Method? if yes How Can I? Or is only possible in paid version?

I want to buy , but I would like to try and learn something before.

Thanks!

at,

Marcio Valerio.

at,

Marcio Valerio da Silva
Reply
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Welcome to the forums Marcio!

As Edhy said, you'll typically need to create fill methods (see the help file) to load the BO. There are a few that are built in that are pretty handy.

  • FillByPrimaryKey: fill BO with a single record, using the PK of the table.
  • FillByParentPrimaryKey: fill BO with records matching a FK to a parent table (think fill orders for a single customer).
  • FillDataTable: This is what you'll use to build your own.

Here is one I use in test apps a lot, just to load some data into a BO for some other test I'm doing. This goes into the BO code file.

/// <summary>
/// Fill the BO with the indicated number of records. This is
/// generic enough to use with any BO.
/// </summary>
public void FillTopN(int n)
{
    //-- Build SQL Statement.
    StringBuilder sqlBuilder = new StringBuilder();
    sqlBuilder.AppendFormat("Select Top {0} *\n", n);
    sqlBuilder.AppendFormat("From {0}", this.TableName);

    //-- Load data.
    using (SqlCommand cmd = new SqlCommand())
    {
         cmd.CommandText = sqlBuilder.ToString();
         this.FillDataTable(cmd);
    }
}


Let us know if you run into any problems.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search