Updating the same record from two sequetial asp pa

Results 1 to 2 of 2

Thread: Updating the same record from two sequetial asp pa

  1. #1
    Join Date
    Dec 1969

    Default Updating the same record from two sequetial asp pa

    Can someone please point me in the right direction...<BR><BR>I have a asp page that will create a SQL Server database record. Then the user will hit the "NEXT" button which takes them to a second asp page. Here they will enter more information that will need to be used to update the same record that was created on the previous page.<BR><BR>Any ideas? How can I make sure that the second page knows which record to update?<BR><BR>Thanks

  2. #2
    JohnH Guest

    Default RE: Updating the same record from two sequetial as

    in creating a new record - i have found it helpfull to require each user to pick a unique User ID for themselves - during the initial sign-up process do a search for that ID to make sure nobody else has already used it. then after creating a new record, reopen the database - and select the key field where the Unique userid matches the one chosen by that customer :<BR>%&#062;<BR>sqlstmt = "SELECT ID from Customers WHERE UserID=&#039" & UserID & "&#039"<BR><BR>&#060;%<BR>to make sure that you update the correct record on the second page, just make the [next] buton pass the key field value - in updating the record you will have had to have this field in state already - so your [next] button if it is a URL link will look like : ( assume that ID is your key field )<BR><BR>&#060;a href="your_next_page.asp?ID=&#060;%=ID%&#062;"&#06 2;Next&#060;/a&#062;<BR><BR>on your next page, grab the key field variable using<BR><BR>&#060;%<BR>request.querystring("ID")< BR>%&#062;<BR>then your update statement will look like this :<BR>&#060;%<BR> sqlstmt = "UPDATE Customers"<BR> sqlstmt = sqlstmt & "Feild1=&#039" & Field1 & "&#039,"<BR> sqlstmt = sqlstmt & "Field2=&#039" & Field2 & "&#039,"<BR> sqlstmt = sqlstmt & "Field3=&#039" & Field3 & "&#039"<BR><BR> sqlstmt = sqlstmt & " WHERE ID=" & ID<BR>%&#062;<BR>equally you could pass the variable in a form field - if it better suited what you are doing from page to page.<BR><BR>Hope this helps.<BR><BR>

Posting Permissions

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