ASP and SQL Server Question

Results 1 to 3 of 3

Thread: ASP and SQL Server Question

  1. #1
    Join Date
    Dec 1969

    Default ASP and SQL Server Question

    I have a table in SQL Server 7 with the fileds<BR>tblCase<BR>CaseID int 4 Identity<BR>ClientID int 4 <BR>PrimaryIssue int 4<BR><BR>I have a asp page that creats a new record to the tblCase. Is there a way to add a new record to this table and find out what the CaseID of the new record you just add? I am doing it in ASP<BR><BR>Bill

  2. #2
    cip Guest

    Default RE: ASP and SQL Server Question

    There are 2 ways of doing that.<BR>1. Using a recordset and AddNew + Update and then accessing rs("CaseId") after the update<BR>2. Checking the value of @@IDENTITY set by the Sql Server to the value of the last inserted identity value.<BR>Cheers,<BR>Ciprian Miclaus

  3. #3
    Curtis Guest

    Default RE: ASP and SQL Server Question

    yea.. what he means is that when you add a new record the "recordset" is automatically set to the "last record added" so if you just do a response.write(rs("CaseId") it should print out the CaseId that you just added. but you also need to have &#060;% response.buffer = "true"%&#062; right under the VBSCRIPT HEADER TAG<BR>&#060;% @Language = "VBSCRIPT" %&#062;<BR><BR>good luck to you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts