I am in the process of migrating some legacy code to LINQ to SQL and I am having some difficulty with the following Stored Procedure.
BEGIN
INSERT INTO tblCMOEncounterHeader (
submitter_organization_id,
submission_date,
begin_posting_date,
end_posting_date,
number_of_records_transmitted)
VALUES (
@submitter_organization_id,
@submission_date,
@begin_posting_date,
@end_posting_date,
@number_of_records_transmitted)
RETURN @@ROWCOUNT
END
Specifically, what does @@ROWCOUNT return when partnered with an INSERT? How would I accomplish the same thing in LINQ?
MSDN
In your case it will always return
1, I guess, or raise an error in case of constraint violation, etc.Your LINQ to SQL code should definitely
return (numsRowsAffected > 0);, i.e. a boolean value or something similar