>>>Hi,
>>>
>>>I use CursorAdapters for inserting/updating/delete data in SQL Server. I have a base class that all tables use. The problem is when I try to delete a record in one of the tables it does not work. I get no error and when I step through the code in debugger everything seem to be normal. But the record in SQL Server never gets deleted. I have checked the code in the CursorAdapter class, method BeforeDelete and it correctly has expression:
>>>
>>>delete from TableName where Pk_Fld = ?oldval('Pk_fld','CaViewName')
>>>
>>>
>>>I also checked in the same method that the value of oldVal('pk_fld') is the one I am trying to delete.
>>>
>>>When I delete a record from another table (using the same base class), it works.
>>>
>>>Where should I look for? In SQL Server? or in my VFP code? TIA.
>>
>>
>>Run SQL Profiler and see what happens at the SQL Server end.
>
>Here is the line from the SQL Server Profiler trace relevant to the table where I am deleting a record:
>
>exec sp_executesql N'DELETE FROM EQ_FILE WHERE EQUIP_PK=@P1 ',N'@P1 int',755
>
>
>The value 755 above is the actual PK value that I am attempting to delete.
>
>The EventClass says 'RPC:Completed.
>
>So it look (at least to me) as everything should work. Yet the record of PK 755 is never deleted.
>
>What am I missing?
Have you tried running this exact command (copy and paste it in SSMS)?
If it's not broken, fix it until it is.
My Blog