I have created a silverlight remote data portal app which is working fine.
We now have a need to delete business base objects.
But keep getting System.NotSupportedException: Invalid operation - delete not allowed error.
Code is as follows
public static void DeleteEmployee(Int32 sEM_ID,EventHandler<DataPortalResult<Employee>> handler)and then
protected override void DataPortal_Delete(object Crits)
{
Criteria crit = (Criteria)Crits;
using (SqlConnection cn = new SqlConnection(DataBase.MakingSpaceOperationsConnection))
{
cn.Open();
using (SqlCommand cmd = new SqlCommand("JM_Employee_Delete", cn))
{
ApplicationContext.LocalContext["dpConnection"] = cn;
ApplicationContext.LocalContext["dpCommand"] = cmd;
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@SEM_ID", crit.SEM_ID);
onDeletePre(cmd, EventArgs.Empty);
cmd.ExecuteNonQuery();
onDeletePost(cmd, EventArgs.Empty);
}}}
It gives no error and compiles but when run using
Employee
.DeleteEmployee(1, DeleteEmployees); It returns the Delete not allowed error. We have stepped throught the code and cannot see anything wrong we seem to have overridden the method successfully.
Has anybody got any ideas
Cheers
Daniel
Thanks for the reply.
I tried that at first but it did not work. Putting it back gives
However after more digging I have found that it works fine if I use the singlecriteria but if I try to use my own Criteria it gives the Invalid operation - delete not allowed error
I guess I might be setting up my criteria wrong but it works for the fetch fine
Anybody else got any ideas
Cheers
Daniel
Copyright (c) Marimer LLC