In my database there two table call sample and sample customer in sample table primary key is sample_Note_no and it is a foreign key in sample_customer table I got same error after I wrote this coding also
ALTER TABLE Sample Customer
ADD CONSTRAINT FK_Sample Customer_Sample
FOREIGN KEY (Sample_NOTE_No)
ON DELETE CASCADE
I think you are applying the cascade delete to the wrong table.
You are altering the table Sample Customer to include a Foreign Key (Sample_Note_No) linked to Sample.Sample_Note_No but you are then saying if the record in Sample Customer is deleted, delete the corresponding record in Sample.
Therefore SQL is stopping you because if you did this you would delete the record in Sample and potentially leave orphaned records in the Sample Customer table (assuming a One to Many relationship, which SQL server is.)
I think you want to apply the cascade to the Sample Table so if you delete the record there you delete any child records in Sample Customers.
I Developed application in C# with crystal reports and created setup file in third party (Advance) Installer.When i installed my application on client system application is working but ...