View Full Version : check whether record has been updated successfully
charon
04-25-2003, 05:59 AM
Well, Until now I find that all the sample code for updating /deleting/adding..etc (any transaction)records never has a validation for checking whether a record has been updated successfully. For instance:
If Not objRS.EOF Then
objRS("name") = name
objRS("ic") = ic
objRS("sex") = sex
objRS.Update
msg = "The record has been updated"
End If
Does the recordset has an error property such as:
if Rs.Error <> 0 Then
msg = "The record has been updated
end if
i'm now trying to look for this via internet..
Not sure about that code.
But when you run an execute, you can include a variable as parameter that gives back the number of updated records. (which is of coarse not the ID of the actual record, but it's mostly sufficient for me. If you really need to have the number, then you'll need to have some sort a update variable where you store a value that you can use in a second statement to select on.
dim numupdated 'just pick any variablename
connection.Execute sql, numupdated 'just add it to the execute command
if numupdates = 0 then
blablabla
else
blablabla
end if
The same thing works for deleting and inserting.
charon
04-25-2003, 01:40 PM
Just would like to ask, just like what it said, Microsoft Transaction Server is designed to make it easier to build high-performance, scaleable and reliable intranet and Internet applications. why I never see any of the ASP sample applications using @transaction for their asp applications??
Roy Sinclair
04-25-2003, 02:39 PM
Originally posted by charon
Just would like to ask, just like what it said, Microsoft Transaction Server is designed to make it easier to build high-performance, scaleable and reliable intranet and Internet applications. why I never see any of the ASP sample applications using @transaction for their asp applications??
Sample applications are usually targeted at the lowest common demoninator, they always leave out anything that would confuse the issue. Of course that also leaves just about no chance of seeing how things are done properly.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.