首页 > 开发 > 综合 > 正文

在VB组件中使用串缓冲 - 3

2024-07-21 02:15:42
字体:
来源:转载
供稿:网友


收集最实用的网页特效代码!

lesson 3 : the asp file
--------------------------------------------------------------------------------

how2project4.asp

the asp code
we can now use our component from any asp page. here we set our connection string, the sql statement, and
the number of fields that our sql statement returns from the database. all these variables could be set
locally in the methodname() method instead of being sent as method parameters.

<%
"~~~~~~~~~~~~~~~~~~ set object ~~~~~~~~~~~~~~~~~
set oclass = server.createobject("how2project4.classname"

"~~~~~~~~~~~~ set method parameters ~~~~~~~~~~~~~
strdbconnectionstring = "strdsn"
strsql = "select examplefieldid, examplefield1, examplefield2 from exampletable"
intfieldcount = 3

"~~~~~~~~~~~~~~ get table record ~~~~~~~~~~~~~
strhtmltabletr = oclass.methodname(strdbconnectionstring, strsql, intfieldcount)
%>

<html><head><title>how2 example</title></head><body>

<table border="1" cellspacing="3">
<%= strhtmltabletr %>
</table>

</body></html>

<%
set oclass = nothing
%>


once the object is instantiated and the method called, a fully formed table record (tr) will be returned
as a string. placing it between opening and closing table tags will display the following:

1 100 text field 2a
2 200 text field 2b
3 300 text field 2c
4 400 text field 2d
5 500 text field 2e
6 600 text field 2f


again, for more specific information on the database used here, and an alternative way to populate an asp
table, read the "how to pass a variant array populated with a recordset from a vb component to an asp
file" and the "how to pass a recordset from a vb component to an asp file" articles.

happy coding….

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表