Im looking to take an auto-incremented Id#, CaseID, and insert that generated number into CaseID Columns in several other tables in that DataBase. It was suggested to me to either use @@Identity, or SCOPE_IDENTITY(). I am not sure which one is most appropriate to my situation nor do I have the knowledge to make either of them work at the moment. Was wonder what will be the best method to do this process. I am using C# and asp.net 4. Some code that i have so far:
DataSource on first page that will auto generate the id:
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
InsertCommand="INSERT tblDemographics (Facility, Review, Quarter, PCN, Program, MR, DOB, Gender, SOC, Discharge, Reference, Diagnostic)
VALUES (@Facility, @Review, @Quarter, @PCN, @Program, @MR, @DOB, @Gender, @SOC, @Discharge, @Reference, @Diagnostic)
SELECT @CaseID = SCOPE_IDENTITY()"
<asp:Parameter Name="Facility" />
<asp:Parameter Name="Review" />
<asp:Parameter Name="PCN" />
<asp:Parameter Name="Program" />
View Complete Post