Using a string buffer in a VB component-3

Source: Internet
Author: User
Lesson 3:the ASP File
--------------------------------------------------------------------------------

How2project4.asp

The ASP Code
We can now use my component from any ASP page. Here we set our connection string, the SQL statement, and
The number of fields that we SQL statement returns from the database. All this 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 ~~~~~~~~~~~~~
STRHTMLTABLETR = Oclass.methodname (strdbconnectionstring, strSQL, Intfieldcount)
%>


<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) would be returned
As a string. Placing it between opening and closing TABLE tags would display the following:

1 Text Field 2a
2 Text Field 2b
3 Text Field 2c
4 Text Field 2d
5 Text Field 2e
6 Text Field 2f


Again, for more specific information in the database used here, and a 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" "How to", "a RecordSet from a VB Component to a ASP File" articles.

Happy coding .....



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.