Skip to main content

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. 

icon-quote.gifHenk:

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 aPosition], Principal FROM ]DirectorsBoard.getCompanyDirectors] WHERE (CompanyID = @CompanyID)";
cmd.Parameters.Add(new SOParameter("CompanyID", companyId));

using( SODataReader reader = cmd.ExecuteReader() )
{
//do whatever
}

Reply