I need to retrieve the identity value after the record has been created for another datasource. I.E. When the record is created in SqlDataSource7 the identity value (4700) would be assigned to Label1.text and used in SqlDataSource8 to insert a new record. How do I do this? In the CodeBehind retrieve the identity value using SqlDataSource7 Scope_Identity() and putting that value into the SqlDataSource8 ApplicantID column. Thank you in advance for your help.
<asp:SqlDataSource ID="SqlDataSource7" runat="server"
ConnectionString="<%$ ConnectionStrings:RARConnectionString %>"
InsertCommand="INSERT INTO tblApplicant(UserID, ApplicationDate, FName, LName, MI, SSNumber, Address, UnitNumber, City, State, Zip, Address2, County, Email, HomePhone, CellPhone, WorkPhone, HasAppliedForWZ, MailVouchers, ReadAgreement) VALUES (@UserID, GETDATE(), @FName, @LName, @MI, @SSNumber, @Address, @UnitNumber, @City, @State, @Zip, @Address2, @County, @Email, @HomePhone, @CellPhone, @WorkPhone, @HasAppliedForWZ, @MailVouchers, @ReadAgreement); Select
View Complete Post