Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update disconnected recordset and save as XML

Status
Not open for further replies.
Jan 26, 2001
550
GB
Hi all

I have a page which opens a disconnected recordset, makes some changes to the data in some fields (encrypting those fields), and then saves the recordset as XML to the server using the recordset.save method.
It is working apart from one thing. The changes that I make to the recordset do not persist through to the xml file, which contains only the original, unmodified data.

Could anyone shed any light on this? The relevant code i am using is shown below:

Set rsOrders = Server.CreateObject("ADODB.Recordset")
rsOrders.ActiveConnection = MM_DDD_STRING
rsOrders.Source = strSQL
rsOrders.CursorType = 1
rsOrders.CursorLocation = 3
rsOrders.LockType = 4
rsOrders.Open()
Set rsOrders.ActiveConnection = Nothing

Response.Write "Before:" & rsOrders("BOOKING_CARDTYPE") & "<br/>"

rsOrders("BOOKING_CARDTYPE").Value = EnDeCrypt(rsOrders("BOOKING_CARDNUMBER"), varPass)
rsOrders("BOOKING_CARDNAME").Value = EnDeCrypt(rsOrders("BOOKING_CARDNAME"), varPass)
rsOrders("BOOKING_STARTDATE").Value = EnDeCrypt(rsOrders("BOOKING_STARTDATE"), varPass)
rsOrders("BOOKING_EXPIRYDATE").Value = EnDeCrypt(rsOrders("BOOKING_EXPIRYDATE"), varPass)
rsOrders("BOOKING_ISSUENUMBER").Value = EnDeCrypt(rsOrders("BOOKING_ISSUENUMBER"), varPass)
rsOrders("BOOKING_SECURITYCODE").Value = EnDeCrypt(rsOrders("BOOKING_SECURITYCODE"), varPass)
rsOrders("BOOKING_CARDNUMBER").Value = EnDeCrypt(rsOrders("BOOKING_CARDNUMBER"), varPass)

Response.Write "After: " & rsOrders("BOOKING_CARDTYPE")

rsOrders_numRows = 0

If request("BookingID") > 0 Then
' save the recordset as xml datastream
rsOrders.Save filepath,1
rsOrders.Close()
Set rsOrders = Nothing
End If

Many thanks

Nick

Nick (Webmaster)

 
Maybe try doing a .Update on the recordset before saving it?

barcode_1.gif
 
what if, as a test, you just flat out change the value:
rsOrders("BOOKING_CARDNAME").Value = "FAKE VALUE"

Maybe it just isnt saving anything or is being overwritten and the encryption is superflous to the problem?
 
Did you truly intend to set BOOKING_CARDTYPE to BOOKING_CARDNUMBER?
rsOrders("BOOKING_CARDTYPE").Value = EnDeCrypt(rsOrders("BOOKING_CARDNUMBER"), varPass)

And though this may seem silly, are you absolutely certain that request("BookingID") is returning a value greater than 0 so that the save is happening? Obviously you have a saved file but is it being overwritten with the changes?
If for some reason BookingID is not passing in then it will not overwrite the existing file and so you still look at old data.


It's hard to think outside the box when I'm trapped in a cubicle.
 
Hi Sheco

Thanks for that, but again, I already tested it by hardcoding one of the new values straight into the recordset. Still the problem persisted. It is evident that the recordset has 'accepted' the changes as it is printing out the new values when I response.write the contents after making the changes.
It is almost as if the recordset.save method is disregarding any changes made and only using the original unmodified data. I tried changing the 'filter' options for the recordset but this also had no effect.

(Some of the keen eyed amongst you may spot a typo where i am setting the 'CARDTYPE' value to the 'CARDNUMBER' value by accident in the code above. This is also not the cause of the problem as it still occurs now this is fixed.)

Many thanks

Nick

Nick (Webmaster)

 
Hi Niteowl

Please see my last reply r.e. the mis-setting of the cardnumber field to the card type field - this was a type but not the cause of the problem.

The booking id is definitely being passed correctly (and manually) via the querystring. On each try I am deleting the XML file and allowing it to be recreated to be sure that I am not looking at old data.

Any other ideas?

Thanks for all your help

Nick

Nick (Webmaster)

 
>[tt]If request("BookingID") > 0 Then[/tt]
Why do you have such confidence on the conversion to go smooth rather than type mismatch in odd cases?
 
Hi tsuji

The script will only be called by a remote script which will always specify a booking id.
To be honest though, this part is irrelevent to the problem in hand, which is to do with the information being written by the recordset.save method, which most definitely IS being called in my testing.

Thanks

Nick

Nick (Webmaster)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top