How can we know the Recordset is process Add function currently?
When the AddNew method is being used, the Recordset have a properties "EditMode" which will return a value to identify the Recordset if it has processed AddNew method:
The value is:
0 - adEditNone
1 - adEditInProgress
2 - adEditAdd (Perform AddNew method)
4 - adEditDelete (Process delete record)
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
Response.Write(rs.EditMode & "
")
rs.AddNew
Response.Write(rs.EditMode & "
")
rs.Fields("MemberName")="Eric"
rs.Fields("Location")="UK"
rs.Update
Response.Write(rs.EditMode & "
")
rs.Close
Set rs = Nothing
%>
No comments:
Post a Comment