Solved, I remove the P type
removed
define class REST::myRestAPI::ContactName
dim FirstName as c
dim LastName as c
end class
Regards,
Khanafi
Code:
define class REST::myRestAPI function createNewCustomer as p (newCustomer as REST::myRestAPI::newCustomer) dim CustomerID as c = newCustomer.CustomerID dim CompanyName as c = newCustomer.CompanyName dim ContactName as c = newCustomer.ContactName dim ContactTitle as c = newCustomer.ContactTitle dim cn as sql::connection dim flag as l flag = cn.open("::Name::northwind") if flag = .f. then 'there was an error dim errorText as c errorText = cn.callresult.text end end if 'turn on portable SQL cn.PortableSQLEnabled = .t. dim SQL as c sql = "INSERT INTO customers(CustomerID,CompanyName,ContactName,ContactTitle) VALUES (:CustomerID,:CompanyName,:ContactName,:ContactTitle)" dim args as sql::arguments args.add("CustomerID",CustomerID) args.add("CompanyName",CompanyName) args.add("ContactName",ContactName) args.add("ContactTitle",ContactTitle) 'execute the SQL flag = cn.execute(sql,args) if flag = .f. then 'there was an error dim errorText as c errorText = cn.callresult.text cn.close() end end if dim rowsInserted as n 'get the number of rows that were inserted rowsInserted = cn.CallResult.rowsaffected cn.close() 'TIP: You can also use the sql_insert() helper function instead of using the low-level Xbasic commands 'dim field_value_pairs as c 'field_value_pairs = <<%txt 'CustomerID=CustomerID 'CompanyName=CompanyName 'ContactName=ContactName 'ContactTitle=ContactTitle '%txt% 'dim cn as sql::connection 'cn.open("::Name::northwind") 'dim p as p 'p = sql_insert(cn,"customers",field_value_pairs ) 'flagHasError = p.error 'errorText = p.errorText end function end class define class REST::myRestAPI::newCustomer dim CustomerID as c dim CompanyName as c dim ContactName as c dim ContactTitle as c end class
define class REST::myRestAPI::ContactName
dim FirstName as c
dim LastName as c
end class
Regards,
Khanafi
Comment