HTML Tutorials |
|
XML Tutorials |
|
Browser Scripting |
|
Server Scripting |
|
.NET (dotnet) |
|
Multimedia |
|
Web Building |
|
Java Tutorials |
|
Programming Langauges |
|
Soft Skills |
|
Database Tutorials |
|
Operating System |
|
Software Testing |
|
SAP Module |
|
Networking Programming |
|
Microsoft Office |
|
Accounting |
|
|
En employant la méthode de GetString () nous accélérons notre manuscrit d'asp au lieu d'employer Response.Write multiple.
|
Nous pouvons augmenter la vitesse de notre manuscrit d'asp en employant la méthode de GetString () au lieu de writting la méthode multiple de Response.Write ().
|
Ici un exemple de la méthode multiple de Response.Write () a employé cette exposition comment montrer une question de base de données dans une table de HTML :.
|
<html>
<body>
<h2>Delete Record</h2>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/database/dataone.mdb"
cid=Request.Form("employeeID")
if Request.form("companyname")="" then
set rs=Server.CreateObject("ADODB.Recordset")
rs.open "SELECT * FROM employee WHERE employeeID='" & cid & "'",conn
%>
<form method="post" action="demo_delete.asp">
<table>
<%for each x in rs.Fields%>
<tr>
<td><%=x.name%></td>
<td><input name="<%=x.name%>" value="<%=x.value%>"></td>
<%next%>
</tr>
</table>
<br /><br />
<input type="submit" value="Delete record">
</form>
<%
else
sql="DELETE FROM employee"
sql=sql & " WHERE employeeID='" & cid & "'"
on error resume next
conn.Execute sql
if err<>0 then
response.write("No update permissions!")
else
response.write("Record " & cid & " was deleted!")
end if
end if
conn.close
%>
</body>
</html>
|
|
Pour une grande question, nous écrivons la méthode de Response.write () pas de temps, ceci pouvons ralentir la durée de la transformation de manuscrit, puisque beaucoup de commandes de Response.Write doivent être traitées par le serveur.
La solution est de faire créer la corde entière, du <table> à </table>, et l'a puis produit - en utilisant Response.Write juste une fois.
|
La méthode de GetString ()
|
La méthode de GetString () laisse montrer la corde avec writting seulement une méthode de Response.Write (). Elle élimine… code de boucle et l'essai conditionnel qui vérifie si le recordset est à l'EOF.
|
str = rs.GetString(format,rows,coldel,rowdel,nullexpr)
|
|
To create an HTML table with data from a recordset, we only need to use three of the parameters given bellow.These three parametre are optional.
coldel - the HTML to use as a column-separator
rowdel - the HTML to use as a row-separator
nullexpr - the HTML to use if a column is NULL
|
<html>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/database/dataone.mdb"
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT Companyname, Contactname FROM employee", conn
str=rs.GetString(,,"</td><td>","</td></tr><tr><td>"," ")
%>
<table border="1" width="100%">
<tr>
<td><%Response.Write(str)%></td>
</tr>
</table>
<%
rs.close
conn.close
set rs = Nothing
set conn = Nothing
%>
</body>
</html>
|
|
The str variable in above program contains a string of all the columns and rows returned by the SQL SELECT statement.Between each column the HTML </td><td> will appear, and between each row, the HTML </td></tr><tr><td> will appear. This will produce the exact HTML we need with only one Response.Write() method was used.
|
Keywords:ADO Speed Up, visual basic ado, ado stored procedure, ado ms access, ado asp net, ado insert into,
ado sql server, microsoft access ado, ado vb net, ado visual basic 6
|
|
HTML Quizes |
|
XML Quizes |
|
Browser Scripting Quizes |
|
Server Scripting Quizes |
|
.NET (dotnet) Quizes |
|
Multimedia Quizes |
|
Web Building Quizes |
|
Java Quizes |
|
Programming Langauges Quizes |
|
Soft Skills Quizes |
|
Database Quizes |
|
Operating System Quizes |
|
Software Testing Quizes |
|
SAP Module Quizes |
|
Networking Programming Quizes |
|
Microsoft Office Quizes |
|
Accounting Quizes |
|
|