Also, have you looked into the following articles? Reason I ask is because there are a lot of other ways to access data through the API without having to create custom SQL database objects. I personally take advantage of page type queries. I'll create a query in there even if it is only SELECT * FROM External_Table1 WHERE ##WHERE## ORDER BY ##ORDERBY##
or EXEC SP_Name param1
. This way it leaves the code open for me to edit in the UI and access easily in code without having to change the C# code if the query changes
http://devnet.kentico.com/articles/kentico-8-technology-dataquery
https://docs.kentico.com/display/K8/Working+with+database+queries+in+the+API
http://devnet.kentico.com/articles/kentico-8-technology-dataquery-advanced-api
http://devnet.kentico.com/articles/kentico-8-technology-documentquery-api
This code should get you going in the right direction:
QueryDataParameters parameters = new QueryDataParameters();
parameters.AddGuid("@ItemGuid", Guid);
GeneralConnection cn = ConnectionHelper.GetConnection();
QueryParameters qp = new QueryParameters("DELETE " + customTable.ClassTableName + " WHERE ItemGUID = @ItemGuid", parameters, QueryTypeEnum.SQLQuery, false);
cn.ExecuteNonQuery(qp);