Help needed with ado.net and smart objects

Last post 08-06-2008, 9:35 AM by cmurphy54. 1 replies.
Sort Posts: Previous Next
  •  08-06-2008, 2:23 AM 25385

    Help needed with ado.net and smart objects

    I am trying to extract smart object data by making use of a sql statement.

    My smart object is called DirectorsBoard and my method is called getCompanyDirectors which required the smart object property CompanyID.

    I use the following Syntax:

    SELECT     [Position], Principal
    FROM         [DirectorsBoard.getCompanyDirectors]
    WHERE     (CompanyID = @CompanyID)

    When I test the query I am getting an error: Smartobject property CompanyID is a required property for selected method getCompanyDirectors.

    Even when I set my parameter value, any reason for this?  It work fine when I cal the method using the stored procedure syntax. 

    Filed under: ,
  •  08-06-2008, 9:35 AM 25392 in reply to 25385

    Re: Help needed with ado.net and smart objects

    Henk:

    I use the following Syntax:

    SELECT     [Position], Principal
    FROM         [DirectorsBoard.getCompanyDirectors]
    WHERE     (CompanyID = @CompanyID)

     You'll have to do something like this when there are required parameters:

    SOCommand cmd = new SOCommand();
    cmd.Connection = conn; cmd.CommandText = "SELECT [Position], Principal FROM [DirectorsBoard.getCompanyDirectors] WHERE (CompanyID = @CompanyID)"; cmd.Parameters.Add(new SOParameter("CompanyID", companyId)); using( SODataReader reader = cmd.ExecuteReader() ) { //do whatever }

    Colin
    K2 Insider
    K2 Blog: K2 Thought
View as RSS news feed in XML