How to add a new record to the database?
We can use AddNew method to add a new record to the database.
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 'Start Add new record
rs.Fields("MemberName")="Alvin" 'Assign the new value
rs.Fields("Location")="UK"
rs.Update 'Save the new data.
rs.Close
Set rs = Nothing
%>
No comments:
Post a Comment