This creates a database instance, but what is a database instance? Also, rs is not a variable. How does it perform operations such as rs.update in the program? Open means how to receive data from rs?
is to create a data set
This data set should be defined first
dimrs as adodb.recordset
Then you can use
set rs=server.CreateObject("adodb.recordset")
To create an instance of the data set, of course there is no data in the data set at this time
rs.open......
to open a recordset
rs.append or rs.insert to add records
rs.edit to modify records
For added or modified records, you can use
rs.fields("field name")=xxx
to assign
rs.update
Update changed values back to the database
When you add a data (rs1) into the database:
rs.addnew
rs("rs1")="Added data"
rs.update
rs.close
set rs=nothing
Let's take an example below:
Set mRs= Server.CreateObject("adodb.recordSet")
mRs.open "Select * from book", conn, 1, 3
mRs.addnew
mRs("Name") = Name
mRs("Mail") = Mail
mRs("Qq") = Qq
mRs("Info") = Info
mRs("time") = now()
mRs.update
mRs.close
Set mRs = nothing
//The following is to call the html input box
Copy the code code as follows:
<table cellpadding="0">
<form method="post" action="admin/<% =filename %>?action=Reply&id=<% =id %>">
<tr>
<td bgcolor="#EFEFEF">Nickname:</td>
<td>
<input type="text" value="<% =mRs("Name") %>">
</td>
</tr>
<tr>
<td bgcolor="#EFEFEF">Is the content public:</td>
<td>
<input type="radio" value="1" <%if mRs("qq")=1 then response.write " checked " end if%> >
yes
<input type="radio" value="0" <%if mRs("qq")=0 then response.write " checked " end if%> >
No</td>
</tr>
<tr>
<td bgcolor="#EFEFEF">Email:</td>
<td>
<input type="text" value="<% =mRs("Mail") %>">
</td>
</tr>
<tr>
<td bgcolor="#EFEFEF">Leave a message:</td>
<td>
<textarea rows="9" cols="57"><% =mRs("Info") %></textarea>
</td>
</tr>
<tr>
<td bgcolor="#EFEFEF">Reply:</td>
<td rowspan="2" bgcolor="#EFEFEF">
<textarea rows="6" cols="50"><% =Reply %></textarea>
</td>
</tr>
<tr>
<td bgcolor="#EFEFEF"></td>
</tr>
<tr>
<td colspan="2" bgcolor="#EFEFEF">
<input type="submit" value="Reply to message">
<input type="reSet" value="Re-enter">
</td>
</tr>
</form>
</table>