How to cancel the Add function in the ADO Recordset?
When you perform the Add function, your user detection has already been disconnected.
Now, How to cancel the add function?
The ASP codes are written and described as below:
<%
Set conn = Server.CreateObject("Adodb.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")
Set rs = Server.CreateObject("Adodb.Recordset")
rs.open "Member",conn,1,3
rs.AddNew
If Not Response.IsClientConnected Then 'Opps, the user is disconnected.
rs.CancelUpdate 'Cancel Add function
Else
rs.Fields("MemberName")="Alvin"
rs.Fields("Location")="UK"
End if
rs.Update
rs.Close
Set rs = Nothing
%>
No comments:
Post a Comment