帝国软件
  设为首页 加入收藏 关于我们
 
解密帝国网站管理系统
栏 目:
 
您的位置:首页 > 技术文档 > ASP编程
在VB组件中使用串缓冲 - 3
作者: 发布时间:2005-03-12 来源:
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….

  
评论】【加入收藏夹】【 】【打印】【关闭
※ 相关链接
 ·在VB组件中使用串缓冲 - 1  (2005-03-12)
 ·在VB组件中使用串缓冲 - 2  (2005-03-12)
 ·已调试好的asp程序在VB中转换为组  (2005-03-12)
 ·一个在vbscript中读取cookie的程  (2005-03-12)
 ·关于vbscript 与 javascript如何  (2005-03-12)

   栏目导行
  PHP编程
  ASP编程
  ASP.NET编程
  JAVA编程
   站点最新
·致合作伙伴的欢迎信
·媒体报道
·帝国软件合作伙伴计划协议
·DiscuzX2.5会员整合通行证发布
·帝国CMS 7.0版本功能建议收集
·帝国网站管理系统2012年授权购买说
·PHPWind8.7会员整合通行证发布
·[官方插件]帝国CMS-访问统计插件
·[官方插件]帝国CMS-sitemap插件
·[官方插件]帝国CMS内容页评论AJAX分
   类别最新
·在ASP中使用数据库
·使用ASP脚本技术
·通过启动脚本来感受ASP的力量
·学习使用ASP对象和组件
·解析asp的脚本语言
·初看ASP-针对初学者
·ASP开发10条经验总结
·ASP之对象总结
·ASP与数据库应用(给初学者)
·关于学习ASP和编程的28个观点
 
关于帝国 | 广告服务 | 联系我们 | 程序开发 | 网站地图 | 留言板 帝国网站管理系统