The Connection Execute ():
If you are want to retrieve the data from a database then your have no choice but to use a Recordset. However, for the purposes of adding, updating, and deleting data you don ' t necessarily have to have a Recordset. It ' s up to you.
For the purposes of adding, updating and deleting can avoid the Recordset by using the Execute () method.
Get started:
Below is the script for Lesson 19.
<% @LANGUAGE = "JavaScript"%> var strconnect= "Provider=Microsoft.Jet.OLEDB.4.0;" Data source= "StrConnect + = Server.MapPath (" \\GOP ") +" \\datastores\\gop.mdb "<!--METADATA type=" TypeLib "file= Program Files\Common Files\system\ado\msado15.dll "--> <HTML> <HEAD> <title>administrator Page- Changing the mailing list</title> </HEAD> <body link= "Red" vlink= "Red" alink= "Crimson" > <H2>
Administrator page
There ' s no link to the this one in action. I did that for the security reasons. I just want to point out a few highlights.
Danger in the single Quote:
You'll notice that I replace single quote marks with the HTML encoded equivalent. I did that using the following code.
var myregexp =/[']/g;
FirstName = Firstname.replace (Myregexp, "");
The single quote are the only character your cannot input into a database using a ASP application. Everything else is fair game. Don't accept any text from the users into your the database without replacing all single quotes. To use an analogy, the single quote are like a key that opens up your entire database. Hackers'll tear your application to shreds if you have someone input single quotes.
Execute ():
The only other thing I want to spend any time with are
objconn.execute (SQL)
. The variable
SQL
takes on one of two definitions depending in the result of the "if" statement. In this case
SQL
does all the work, and we never need a recordset.