Figure 4   Generated SQL Statements

If Exists (Select * From sysobjects Where name = 'wing_table' And
            user_name(uid) = 'dbo')
     Drop Table dbo.wing_table
 Go
 
 Create Table dbo.wing_table
     (
     title varchar(255) Null,
     text text Null,
     date_created datetime Null Constraint DF_wing_table_date_created Default
         (getdate()),
     object_id int Not Null Identity (0, 1)
     )
 Go
 Alter Table dbo.wing_table Add Constraint
     PK_wing_table Primary Key Nonclustered
     (
     object_id
     )
 Go

Figure 8   Propeller Component

 Option Explicit
 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 'VBWebKB.PropellerArticles.GetArticle
 'This subroutine outputs the full details (title, text, date)
 'of a propeller article to the calling ASP page.
 '
 'Parameters
 '   aspResponse - The Active Server Page response object to write to.
 '   ObjectID - The ID of the article in the database table
 '
 Public Sub GetArticle(aspResponse As ASPTypeLibrary.Response, ObjectID As String)
 'Variables
 Dim strTitle As String      'Article title
 Dim strText As String       'Article text
 Dim strDate As String       'Article date
 Dim strObjectID As String   'Article ID
 Dim strNewLine As String 'Used for sending line feeds
 Dim dEnv As DataEnvironment1 'Our data environment
 Dim lArticleID As Long
 lArticleID = Val(ObjectID)
 
 'Create a carriage-return linefeed
 'We'll use this to help make the outputted HTML more readable
 strNewLine = Chr$(13) + Chr$(10)
 
 'Create an instance of the data environment
 Set dEnv = New DataEnvironment1
 
 'Execute the data environment command to
 'retrive an article
 dEnv.cmdGetArticle (lArticleID)
 
 'Write initial HTML comment to indicate where this component
 'started its output
 aspResponse.Write "<!-- VBWebKB.PropellerArticles.GetArticle Begin-->" & strNewLine
 'Exit Sub
 
 
 If Not dEnv.rscmdGetArticle.EOF Then
 
     'Get data from the recordset
     strTitle = dEnv.rscmdGetArticle(0)
     strText = dEnv.rscmdGetArticle(1)
     strDate = dEnv.rscmdGetArticle(2)
     strObjectID = dEnv.rscmdGetArticle(3)
     
     'Write the Article's Title
     aspResponse.Write "<B>"
     aspResponse.Write strTitle
     aspResponse.Write "</B><BR>" & strNewLine
       
     'Write the Article's Date
     aspResponse.Write strDate
     aspResponse.Write "<BR><P>" & strNewLine
     
     'Write the Article's Text
     aspResponse.Write strText
 
     'Finish off with an HTML break, and a real line-feed
     aspResponse.Write "<br>" & strNewLine
     
 End If
 
 'Indicate where the component finished its output
 aspResponse.Write "<!-- VBWebKB.PropellerArticles.GetArticle End-->" & strNewLine
 
 dEnv.Connection1.Close
 
 End Sub
 
 
 
 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 'VBWebKB.PropellerArticles.GetArticleList
 'This subroutine outputs a list of available propeller articles
 'to the calling Active Server Page.
 '
 'Each article in the outputted list is represented as a hyperlink
 'to another ASP page. This hyperlink contains a identifier that the
 'linked page can use to query the text of the article.
 '
 'Parameters
 '   aspResponse - The Active Server Page response object to write to.
 '   strDetailsPage - The name of the Active Server Page for linking the
 '       article titles to.
 '
 
 Public Sub GetArticleList(aspResponse As ASPTypeLibrary.Response, strDetailsPage
                           As String)
 
 'Variables
 Dim strTitle As String      'Article title
 Dim strDate As String       'Article date
 Dim strObjectID As String   'Article ID
 Dim strNewLine As String        'Used for sending line feeds
 Dim dEnv As DataEnvironment1    'Our data environment
 
 'Create a carriage-return linefeed
 'We'll use this to help make the outputted HTML more readable
 strNewLine = Chr$(13) + Chr$(10)
 
 'Create an instance of the data environment
 Set dEnv = New DataEnvironment1
 
 'Execute the data environment commane
 dEnv.cmdGetArticleList
 
 'Write initial HTML comment to indicate where this component
 'started its output
 aspResponse.Write "<!-- VBWebKB.PropellerArticles.GetArticleList Begin-->" & strNewLine
 
 
 While Not dEnv.rscmdGetArticleList.EOF
 
     'Get data from the recordset
     strTitle = dEnv.rscmdGetArticleList(0)
     strDate = dEnv.rscmdGetArticleList(1)
     strObjectID = dEnv.rscmdGetArticleList(2)
     
     'Write the HTML hyperlink prefix
     aspResponse.Write "<a href="
     aspResponse.Write strDetailsPage
     aspResponse.Write "?oid="
     aspResponse.Write strObjectID
     aspResponse.Write ">"
     
     'Write the Article's Title
     aspResponse.Write strTitle
     aspResponse.Write "</a>"
     
     'Write the Articles Date
     aspResponse.Write " "
     aspResponse.Write strDate
     
     'Finish off with an HTML break, and a real line-feed
     aspResponse.Write "<br>" & strNewLine
     
     'Go on to the next record
     dEnv.rscmdGetArticleList.MoveNext
 Wend
 
 'Indicate where the component finished its output
 aspResponse.Write "<!-- VBWebKB.PropellerArticles.GetArticleList End-->" &  strNewLine
 
 dEnv.Connection1.Close
 
 End Sub

Figure 9   Wing Component

 ///////////////////////////////////////////////////////
 //VJWebKB.WingArticles
 //This object retrieves articles from the wing table.
 //
 import asp.*;
 import com.ms.wfc.data.*;
 import com.ms.*;
 import com.ms.com.*;
 
 /**
  * @com.register ( clsid=6A0FD47C-14F5-11D2-9663-006008A67F04, typelib=6A0FD47B-14F5
    11D2-9663-006008A67F04 )
  */
 public class WingArticles
 {
     
 /**
 GetArticleList
 This subroutine outputs a list of available wing articles
 to the calling Active Server Page.
     
 Each article in the outputted list is represented as a hyperlink
 to another ASP page. This hyperlink contains a identifier that the
 linked page can use to query the text of the article.
     
 Parameters
     aspResponse - The Active Server Page response object to write to.
     strDetailsPage - The name of the Active Server Page for linking the
         article titles to.
 */
 public void GetArticleList(asp.Response aspResponse, String strDetailsPage){
     
     //WFC data objects
     Connection m_con;
     Recordset m_rs;
     
     //Variables
     Variant vstrNewLine;    //Used for sending line feeds
     Variant vstrTitle;        //Article title
     Variant vstrDate;        //Article date
     Variant vstrObjectID;    //Article ID
     Variant vstrDetailsPage; //The url for the details page
     
     try{
         //Create a variant for the details page
         vstrDetailsPage=new Variant(strDetailsPage);
     
         //Create a carriage-return linefeed
         //We'll use this to help make the outputted HTML more readable
         vstrNewLine = new Variant("\n");
     
         //Create a connection to the database.
         m_con = new Connection();
         m_con.setConnectionString ("PROVIDER=MSDASQL;dsn=WebKB;uid=sa;pwd=");
         m_con.setCursorLocation (AdoEnums.CursorLocation.CLIENT);
         m_con.open();
     
         //Create a record set
         m_rs = new Recordset();
         m_rs.setActiveConnection(m_con);
         m_rs.setSource("select title, date_created, object_id from wing_table");
         m_rs.setCursorType(AdoEnums.CursorType.STATIC);
         m_rs.setCursorLocation(AdoEnums.CursorLocation.CLIENT);
         m_rs.setLockType(AdoEnums.LockType.OPTIMISTIC);
         m_rs.open();
     
         //Write initial HTML comment to indicate where this component
         //started its output
         aspResponse.Write(new Variant("<!-- VJWebKB.WingArticles.GetArticleList
             Begin-->"));
         aspResponse.Write(vstrNewLine);
 
         while (!m_rs.getEOF()){
         
             //Get the data for a row
             vstrTitle=m_rs.getField(0).getValue();
             vstrDate=m_rs.getField(1).getValue();
             vstrObjectID=m_rs.getField(2).getValue();
         
             //Write the HTML hyperlink prefix
             aspResponse.Write (new Variant("<a href="));
             aspResponse.Write (vstrDetailsPage);
             aspResponse.Write (new Variant("?oid="));
             aspResponse.Write (vstrObjectID);
             aspResponse.Write (new Variant(">"));
     
             //Write the Article's Title
             aspResponse.Write (vstrTitle);
             aspResponse.Write (new Variant("</a> "));
     
             //Write the Articles Date
             aspResponse.Write (vstrDate);
         
             //Finish off with an HTML break, and a real line-feed
             aspResponse.Write (new Variant("<br>"));
             aspResponse.Write (vstrNewLine);
         
             //Move to next record
             m_rs.moveNext();
         }
         m_rs.close();
         m_con.close();
 
         //Write initial HTML comment to indicate where this component
         //finished
         aspResponse.Write(new Variant("<!-- VJWebKB.WingArticles.GetArticleList End-
                                       ->"));
         aspResponse.Write(vstrNewLine);
     }
     
     //Catch any exceptions and report them.
     catch(Exception e){
         aspResponse.Write(new Variant(e.toString()));
     }
 
 }
 
 
 /**
 GetArticle
 This subroutine retrieves a wing article
 for the calling Active Server Page.
     
 Parameters
     aspResponse - The Active Server Page response object to write to.
     strObjectID - The article's ID.
 */
 public void GetArticle(asp.Response aspResponse, String strObjectID){
     
     //WFC data objects
     Connection m_con;
     Recordset m_rs;
     
     //Variables
     Variant vstrNewLine;    //Used for sending line feeds
     Variant vstrTitle;        //Article title
     Variant vstrDate;        //Article date
     Variant vstrText;        //Article text
     
     try{
         //Create a carriage-return linefeed
         //We'll use this to help make the outputted HTML more readable
         vstrNewLine = new Variant("\n");
     
         //Create a connection to the database.
         m_con = new Connection();
         m_con.setConnectionString ("PROVIDER=MSDASQL;dsn=WebKB;uid=sa;pwd=");
         m_con.setCursorLocation (AdoEnums.CursorLocation.CLIENT);
         m_con.open();
     
         //Create a record set
         m_rs = new Recordset();
         m_rs.setActiveConnection(m_con);
         m_rs.setSource("select title, text, date_created from wing_table where
             object_id=" + strObjectID);
         m_rs.setCursorType(AdoEnums.CursorType.STATIC);
         m_rs.setCursorLocation(AdoEnums.CursorLocation.CLIENT);
         m_rs.setLockType(AdoEnums.LockType.OPTIMISTIC);
         m_rs.open();
     
         //Write initial HTML comment to indicate where this component
         //started its output
         aspResponse.Write(new Variant("<!-- VJWebKB.WingArticles.GetArticle Begin--
                                       "));
         aspResponse.Write(vstrNewLine);
 
         if (!m_rs.getEOF()){
         
             //Get the data for a row
             vstrTitle=m_rs.getField(0).getValue();
             vstrText=m_rs.getField(1).getValue();
             vstrDate=m_rs.getField(2).getValue();
             
             
             //Write the Article's Title
             aspResponse.Write (new Variant("<B>"));
             aspResponse.Write (vstrTitle);
             aspResponse.Write (new Variant("</B><BR>"));
             aspResponse.Write (vstrNewLine);
       
             //Write the Article's Date
             aspResponse.Write (vstrDate);
             aspResponse.Write (new Variant("<BR><P>"));
             aspResponse.Write (vstrNewLine);
     
             //Write the Article's Text
             aspResponse.Write (vstrText);
 
             //Finish off with an HTML break, and a real line-feed
             aspResponse.Write (new Variant("<br>"));
             aspResponse.Write(vstrNewLine);
                           
         }
         m_rs.close();
         m_con.close();
 
         //Write initial HTML comment to indicate where this component
         //finished
         aspResponse.Write(new Variant("<!-- VJWebKB.WingArticles.GetArticle End--
                           >"));
         aspResponse.Write(vstrNewLine);
     }
     
     //Catch any exceptions and report them.
     catch(Exception e){
         aspResponse.Write(new Variant(e.toString()));
     }
 
 }
 }