Solved

Detailed Question About Retrieving a Field Determined by Identity Option in the Table Design

Posted on 2002-03-21
17
244 Views
Last Modified: 2013-12-24
What I would like:
From a Customer Menu page, a user clicks on a "Place New Order" button and is taken to an Order Form page.  There are 3 elements on the Order Form page:
1.  A grid (grdProducts), displaying product information such as product name, description, price, etc.  
2.  A form, consisting of a dropdown box to select the product desired, a textbox to input the quanitity desired, and an "Add Item" button.
3. A grid (grdOrderDetails), displaying order details such as product name, price, quantity, subtotal, etc.

Example of Use:  
When a user first enters the Order Form page, the grdOrderDetails is hidden (since there are no order details when he first enters).  He makes his selection and clicks the "Add Item" button.  He is redirected to the Order Form page, where the grdOrderDetails is now shown, detailing what he just entered.  He can choose to add another item.    

------------------------
Relevant Tables in Database:
*Orders  <- Table Name
-OrderID  <- Primary Key
CustomerID
OrderDate

*OrderDetails
-OrderID
-ProductName
UnitPrice
Quantity

My Problem:
For the OrderID field in the Orders table, I clicked on "Identity" in the table design window (where the coluumn name, datatype, etc. of the fields are specified).  Choosing this option automatically increments the OrderID field in the database every time a new record is added.  I need to have this OrderID value before the user adds an item, because the same OrderID is used in the OrderDetails table (There is one order record, but there can be many corresponding order details records.)  I'm thinking about doing it this way:

PAGE 1:  Customer Menu.  User clicks on "Place New Order" button.
PAGE 2:  Write CustomerID and OrderDate into Orders table -> OrderID created.
PAGE 3:  Retrieve OrderID that was created in PAGE 2 & keep in a session variable.
PAGE 4: Order Form.
PAGE 5: Process Order Form by writing OrderID (in a session variable), ProductName, UnitPrice, and Quantity into OrderDetails table.  Redirect to Order Form/PAGE 4.
 
I have been thinking about this for a long time, and I am really stuck.  I was hoping this might be a common operation that many of you have come across.  Is there a better way to do this?  
This is my first post; I am a complete newbie to Visual InterDev and web development in general, so I sincerely appreciate any help you can give me!  

Peggy
0
Comment
Question by:peggasus88
  • 9
  • 8
17 Comments
 
LVL 6

Expert Comment

by:Jon_Raymond
Comment Utility
I think your process is basically good. It may seem cumbersome but that's the best way to carry out this process.  There may be some ways to improve it.  The OrderID issue depends on the database.  If it's SQL you can use the @@IDENTITY variable and an output parameter to return it from the posting procedure.  I'm not sure if Access can do that.  But, in any case you should retrieve the OrderID from the same procedure or function that posts the first order.  The other thing is that all of this can happen on the same page.  You just post to the same page (use action="#" for the form).  Then based on the posted values you branch to the functions, forms or grids.  It's easier to follow and plan the logic that way, and you don't have to jump from one page to another if the logic determines that a different process is needed.  You can also reuse code by keep a common data connection and form.  As to a session variable, some like to avoid them to save server resources.  So, you could hold it in an orders table along with a userID.  That way you can also return to the order in a later session, or if the session breaks, or to review past orders.
0
 

Author Comment

by:peggasus88
Comment Utility
Hi Jon,

I'm not sure if I'm allowed to reply...But I'm going to give it a try.  =)

Concerning the OrderID issue, you're recommending that I use SQL to INSERT INTO the Orders table and at the same time, return the Identity value?  If you have some time, can you please show me some code snippets of how to use the @@IDENTITY variable and output parameter to return the OrderID?  I've used the '@' notation once in a parameterized stored procedure to input a value to an SQL statement, but I don't know how to return one.  (I'm not using Access by the way.)

Also, in PAGE 2, I already have the CustomerID stored in a session variable when the user logged in (very first page of my web project-NOT PAGE 1 above).  What session variable were you talking about at the end of your Comment?  

Thanks so much for your Comment.
0
 
LVL 6

Accepted Solution

by:
Jon_Raymond earned 75 total points
Comment Utility
Of course you can reply - The CustomerID as a session variable is fine.  If you didn't do that you would need to pass it as a parameter from every page to every other page.  You can do the same with the orderID, but I was just suggesting an alternative method - to post it to the database.   Some feel that with high traffic volumes, every user would be creating session variables and eventually this would impact server performance.  So, passing them from page to page instead - or storing them in a database is an alternative, since those methods only call on the variables when they are needed.  Session variables remain in memory and available during the entire session.  Sessions can also be abandoned by users who leave the computer on while doing other things.  So, with low traffic there is no problem.  But, with high traffic and limited server resources, it could impact performance.

As to the @@IDENTITY,  I'll give it a shot:

Create Procedure spPostOrder
  @ProductName varchar(64),
  @UnitPrice money,
  @OrderID int Output
AS
   INSERT Orders
      (
       ProductName,
       UnitPrice
       )
    VALUES
       (
       @ProductName,
       @UnitPrice
       )

    SET @OrderID=@@IDENTITY

    RETURN @OrderID


Here's another posible way:

Create Procedure spPostOrder
  @ProductName varchar(64),
  @UnitPrice money
AS
   DECLARE @OrderID int
   INSERT Orders
      (
       ProductName,
       UnitPrice
       )
    VALUES
       (
       @ProductName,
       @UnitPrice
       )

    SET @OrderID=@@IDENTITY

    SELECT @OrderID As OrderID


See SQL Books online for more on output parameters.  Basically, on the ASP page you declare a ProductID variable first and pass it into the stored procedure in the first method.  The second method just returns it as a recordset field.


0
 

Author Comment

by:peggasus88
Comment Utility
Hi Jon,

I'm not sure if I'm allowed to reply...But I'm going to give it a try.  =)

Concerning the OrderID issue, you're recommending that I use SQL to INSERT INTO the Orders table and at the same time, return the Identity value?  If you have some time, can you please show me some code snippets of how to use the @@IDENTITY variable and output parameter to return the OrderID?  I've used the '@' notation once in a parameterized stored procedure to input a value to an SQL statement, but I don't know how to return one.  (I'm not using Access by the way.)

Also, in PAGE 2, I already have the CustomerID stored in a session variable when the user logged in (very first page of my web project-NOT PAGE 1 above).  What session variable were you talking about at the end of your Comment?  

Thanks so much for your Comment.
0
 

Author Comment

by:peggasus88
Comment Utility
Geez.  I have no idea why my comment was posted again.  Sorry about that.  Do I really have to shout out to everyone that I'm new?!?  =)
0
 
LVL 6

Expert Comment

by:Jon_Raymond
Comment Utility
Happens all the time.  You might have refreshed your old message page or something.  You might be new but you seem to know the correct way to structure relational tables and keep data normalized.
0
 

Author Comment

by:peggasus88
Comment Utility
I read about keeping data normalized in a beginner Visual InterDev book.  (The book recommended this website actually.)  It seems like SO much trouble right now, but I heard it makes things easier in the long run.  

Does Method 1 for returning @@IDENTITY require a recordset? Can you show me how to pass the parameter and store the return value from the ASP page?  I tried doing it by declaring a global variable (dim g_OrderID) and using a Recordset.setParameter statement.

Having only one page sounds good, but if a page has a form, don't you need to have another page, ProcessOrderForm for example, that has code like adoRS("TableField") = Request.Form("FormField") to extract the form data and place it into the corresponding database table fields?

0
 

Author Comment

by:peggasus88
Comment Utility
I read about keeping data normalized in a beginner Visual InterDev book.  (The book recommended this website actually.)  It seems like SO much trouble right now, but I heard it makes things easier in the long run.  

Does Method 1 for returning @@IDENTITY require a recordset? Can you show me how to pass the parameter and store the return value from the ASP page?  I tried doing it by declaring a global variable (dim g_OrderID) and using a Recordset.setParameter statement.

Having only one page sounds good, but if a page has a form, don't you need to have another page, ProcessOrderForm for example, that has code like adoRS("TableField") = Request.Form("FormField") to extract the form data and place it into the corresponding database table fields?

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:peggasus88
Comment Utility
Must stop refreshing page.
0
 
LVL 6

Expert Comment

by:Jon_Raymond
Comment Utility
He is a sample page.  Soory I don't have time to edit out what is not relevant, like the Javascript.  Anyway, this page use the FileSystemObject to show a list of the subdirectories in a selected directory.  The Main directory is selected from a selectdrop down list.  Their is also a target drop down list with the same choices. the array "ardirSubir" is used to hold the drop down options.  These options could just as well be a recordset.  But the main point here is that when you select something from the drop down list the page posts to itself.  Based on you selection the subdirectories for the selected directory are then listed.  The target drop down posts to another page, which happens to be in another frame.


<%@ Language=VBScript %>
<% Option Explicit%>
<%
Dim iRow
Dim DirMain
Dim DirSub
Dim targetSub
Dim ardirSubir(2)
Dim fso,f,fc,ff,f1
Dim sPP
Dim sUP

ardirSubir(0)="mp3"
ardirSubir(1)="wav"
ardirSubir(2)="swf"

With Request
      If .Form("DirMain") = "" Then
            DirMain="C:\Inetpub\webroot\SKILL_EDIT\music\"
      Else
            DirMain=.Form("DirMain")
      End If
      
      If .Form("DirSub") = "" Then
            DirSub="wav"
            targetSub = "mp3"
      Elseif .Form("DirSub")="mp3" Then
            DirSub="mp3"
            targetSub="swf"
      Else
            DirSub=.Form("DirSub")
            targetSub=.Form("targetsub")
      End If

End With

%>
<HTML>
      <HEAD>
            <LINK rel="stylesheet" type="text/css" href="style.css">
                  <script language="javascript">
      <!--
            var lastDir
            function setDir(dirSub2, dirSub){
                  
                  document.frmDirList.dirSub2.value=dirSub2;
                  //document.frmDirList.DirSub.selectedIndex=dirSub;
                  if (lastDir != undefined){
                        document.frmDirList.elements["img_"+lastDir].src="/editor/music/images/folder.gif";};
      
                  document.frmDirList.elements["img_"+dirSub2].src="/editor/music/images/folder.open.gif";
                  //alert("last="+ lastDir + "; dirSub2=" + dirSub2);
                  lastDir=dirSub2;
                  
                  document.frmDirList.submit();  

            }
            
            function loadDir(){
                  document.frmDirList.action="#";
                  document.frmDirList.target="contents";
                  document.frmDirList.submit();  
            }

            function fileList(){
                  document.frmDirList.action="filelist.asp";
                  document.frmDirList.target="main";
                  document.frmDirList.submit();  
            }
            
            function SaveFileLocal(filename){
                  SaveFile(filename);
            }
      -->
                  </script>
                  <BODY>
                        <TABLE>
                              <form method='post' action='Filelist.asp' id='frmDirList' name='dirList' target='main'>
                                    <input type='hidden' value='<%=dirMain%>' name='dirMain' id='dirMain' size=25> <input type='hidden' name='dirSub2' ID='dirSub2'>
                                    <tr class="formtableheader">
                                          <td colspan="2">Select Directory</td>
                                    </tr>
                                    <tr>
                                          <td colspan="2">
                                                <select id='DirSub' name='DirSub' onchange='loadDir();'>
                                                      <%
                              With Response
                                    For iRow = 0 To UBound(ardirSubir)
                                          If DirSub=ardirSubir(iRow) Then
                                                .Write "<option value='" & ardirSubir(iRow) & "' SELECTED>" & ardirSubir(iRow)
                                          Else
                                                .Write "<option value='" & ardirSubir(iRow) & "'>" & ardirSubir(iRow)
                                          End If
                                    Next
                              End With
                              %>
                                                </select>to
                                                <select id="targetSub" name='targetSub' onchange="fileList();">
                                                      <%
                              With Response
                                    For iRow = 0 To UBound(ardirSubir)
                                          If targetSub=ardirSubir(iRow) And DirSub <> ardirSubir(iRow) Then
                                                .Write "<option value='" & ardirSubir(iRow) & "' SELECTED>" & ardirSubir(iRow)
                                          ElseIf DirSub <> ardirSubir(iRow) Then
                                                .Write "<option value='" & ardirSubir(iRow) & "'>" & ardirSubir(iRow)
                                          End If
                                    Next
                              End With
                              %>
                                                </select>
                                          </td>
                                    </tr>
                                    <%
                  'Dim cDebug
                  'SET cDebug = NEW clsDebug
                  'With cDebug
                  '      .Enabled=true
                        
                  'End With


                  'cDebug.Print dirMain & DirSub, "-dirMain"
                  If Not Request.Form("upldfile") = "" Then
                        SaveFile Request.Form("upldfile")
                  End If
                  
                  If dirMain <> "" Then
                        getFiles()
                  End If

                  Sub getFiles()
                        Set fso = CreateObject("Scripting.FileSystemObject")
                        Set f = fso.GetFolder(dirMain & DirSub)  
                        Set fc = f.Files
                        Set ff = f.SubFolders
                        With response
                              .Write "<tr><td colspan=2>" & DirSub & "</td><tr><td>"
                              For Each f1 in ff
                                    .Write "<img src=""/editor/music/images/folder.gif"" width=""20"" onclick=""setDir('" & f1.name & "','" & DirSub & "');"" id=""img_" & f1.name & """>&nbsp;" & f1.name & "<br>"
                              Next  
                              .Write "</td></tr>"
                        End With
                        Set ff = nothing
                        Set fso = nothing
                        Set f = nothing
                        Set fc = nothing
                  End Sub
                  
            
                  %>
                                    <tr>
                                          <td colspan="2"><hr>
                                          </td>
                                    </tr>
                              </form>
                        </TABLE>
                  </BODY>
</HTML>
0
 
LVL 6

Expert Comment

by:Jon_Raymond
Comment Utility
He is another example.  Sorry for the length.  This shows how you can branch to different outputs based on what is posted to the page.  Note the data comes from a COM object (PreScanAnalysis07.Data).  The COM object makes the data connection and retrieves the data into collections.  The ASP just loops through the collections.  You could do the same with recordsets.  Normally, recorset connections and connection strings are taken care of in a COM object or in and include file with ASP functions.  That's because you tend to need the same connection for many different pages.  Connections strings are also a security risk and should be protected.  So, keeping it in one location helps to control it.

<%@ Language=VBScript %>
<script id="DebugDirectives" runat="server" language="javascript">
// Set these to true to enable debugging or tracing
@set @debug=false
@set @tra=false
</script>

<% Option Explicit
Const WEB = 0
Const STAGING = 1
Const JON = 2
Const adStateClosed = 0
Const RecordsetDATA = 0
Const CollectionDATA = 1
Const PRESCAN_WEB = "209.132.206.83"
Const PRESCAN_STAGING = "Prescansvr"
Const PRESCAN_JON = "Prescanwkst9"
'Response.Buffer = True
If Request("SubmitLogin") = "Login" Then
      Dim oPreData
      Dim iRow
      Dim iCol
      Dim iFieldCount
      Dim rs
      Dim sFieldname
      Dim iProductCategory
      Dim bIsAuthenticated
      Dim sLoginID
      Dim sPassword
      Dim sOutput
      Dim iRowspan
      sOutput = ""
      sLoginID = Request("LoginID")
      sPassword = Request("Password")
      Set oPreData = CreateObject("PreScanAnalysis07.Data")
      If oPreData Is Nothing Then Response.Write "Object Creation Failed<br>"
      With oPreData
            .Prescan_App = JON
            .Categories.GetData
      End With       
      With oPreData.Logins
            .GetData
            For iRow = 1 to .Count
                  With .Item(iRow)
                        If .Password = sPassword And .LoginID = sLoginID Then
                              bIsAuthenticated=True
                              With Response
                                    .Cookies("AnalysisLogin")("LoginID")=sLoginID
                                    .Cookies("AnalysisLogin")("Password")=sPassword
                              End With
                              Exit For
                        Else

                        End If
                  End With
            Next

      End With
Else
      Response.Write "Failed"
End If
If bIsAuthenticated Then

      iProductCategory = CInt(Request("ProductCategory"))
      'sOutput = sOutput
      %>
      <html>
      <head> <title>Prescan Analysis</title>
    <style>      <!--
      .BlueRidge   {
            border: 1 solid #000000;

      }
      .Clear       { border-style: solid; border-color: #FFFFFF }
      .BlueInset   { border: 1 solid #000000 }
      .titleBar {
            border: 0;
            color: white;
            font-size : 12px;
            background : #003399;
            font-family : arial,helvetica,verdana,lucida,utopia;
            padding : 5px;
            font-weight : bold;
      }
      -->
</style>
      </head>
      <body style="border: 2 inset #3399FF" class="BlueInset">
      <form id="frmAnalysis" name="frmData" action="analysis2.asp" method="post">
      <input type="hidden" name="LoginID" value="<%=sLoginID %>">
      <input type="hidden" name="Password" value="<%=sPassword %>">
      <input type="hidden" name="SubmitLogin" value="Login">      
      <p><a href="http://www.prescan.com/"><img border="0" src="images/prescan_head.gif" width="241" height="64"></a></p>
    <div align="left">
      <table border="0">
      <tr>
      <td align="left"><font face="Arial" size="2"><input type="checkbox" name="UserInfo">User Info</font></td>
      <td align="left"><font face="Arial" size="2"><input type="checkbox" name="RegisteredMembers">Registered Members</font></td>
      <td align="left"><font face="Arial" size="2">Select Product Category:</font></td>
      </tr>
      <tr>
      <td align="left"><font face="Arial" size="2"><input type="checkbox" name="fpiTop5" " <%
                  If Request("fpiTop5")="on" THEN
                        Response.Write " CHECKED"
                  End If
          %>>FPI Top 5</font></td>
      <td align="left"><font face="Arial" size="2"><input type="checkbox" name="tppTop5" <%
                  If Request("tppTop5")="on" THEN
                        Response.Write " CHECKED"
                  End If    
          %>>TPP Top 5</font></td>
      <td align="left"><font face="Arial" size="2"><select size="1" name="ProductCategory">      
                <%
                
                      With oPreData.Categories
                            For iRow = 1 To .Count
                                  %><option value="<%=CStr(iRow)%>" <%
                                  If iProductCategory = iRow Then
                                        Response.Write "SELECTED"
                                  End If
                                  %>><%=.Item(iRow).Description%></option><%
                            Next
                      End With %>
                  </select></font></td>
        </tr>
        <tr>
          <td align="left"><font face="Arial" size="2"><input type="checkbox" name="fpiBrands" <%      If Request("fpiBrands")="on" THEN
                              Response.Write "CHECKED"
                        End If   %>>FPI Brands</font></td>
          <td align="left"><font face="Arial" size="2"><input type="checkbox" name="tppBrands" <%      If Request("tppBrands")="on" THEN
                              Response.Write "CHECKED"
                        End If   %>>TPP Brands</font></td>
          <td align="left">
            <p align="right"></td>
        </tr>
        <tr>
          <td align="left"><font face="Arial" size="2"><input type="checkbox" name="fpiTypes" <%      If Request("fpiTypes")="on" THEN
                              Response.Write "CHECKED"
                        End If   %>>FPI Types</font></td>
          <td align="left"><font face="Arial" size="2"><input type="checkbox" name="tppTypes" <%      If Request("tppTypes")="on" THEN
                              Response.Write "CHECKED"
                        End If   %>>TPP Types</font></td>
          <td align="left"><font face="Arial" size="2">
          <input type="submit" value="View Reports" name="sbmtMemberData">
            </font></td>
        </tr>
      </table>
    </div>
      </form>

      <table BORDER="1">
      <%
      If Request("cmdUpdateData")="Update" Then
            With oPreData
                  .ExecADOCommand .Prescan_App, "EXEC sp_UpdateAllAnalysis"
            End With
      Else            
            If request("UserInfo") = "on" Then
                  oPreData.Member.GetData(CollectionDATA)
            %>
      </table>
<!---     <div align="left">            <table border="1" style="border-style: solid; border-color: #FFFFFF; padding-top: 0" cellspacing="0" cellpadding="0">                  <%                   With oPreData.UserInfo                        .Getdata                        For iRow = 1 to .Count                               With .Item(iRow)                  %>                          <tr>                            <td style="border-style: solid; border-width: 1; padding-top: 0" valign="middle" align="right"><font face="Arial" size="2" color="#808080">Date:</font></td>                            <td style="border-style: solid; border-width: 1; padding-top: 0" valign="middle" align="left" NOWRAP><font face="Arial" size="2"><%=.createdate %></font></td>                            <td style="border-style: solid; border-color: #FFFFFF; padding-top: 0" rowspan="4" valign="middle" align="right" class="BlueRidge">&nbsp;</td>                            <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Email:</font></td>                            <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2"><%=.email%></font></td>                            <td style="border-style: solid; border-color: #FFFFFF; padding-top: 0" rowspan="4" valign="middle" align="right" class="BlueRidge">&nbsp;</td>                                        <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Referred By:</font></td>                            <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2"><% =.referredby%></font></td>                          </tr>                          <tr>                            <td style="border-style: solid; border-width: 1; padding-top: 0" valign="middle" align="right"><font face="Arial" size="2" color="#808080">Name:</font></td>                            <td style="border-style: solid; border-width: 1; padding-top: 0" valign="middle" align="left"><font face="Arial" size="2"><%=.firstname & " " & .initial & " " & .lastname%></font></td>                            <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Gender:</font></td>                            <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2"><%=.gender %></font></td>                      <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Birthdate:</font></td>                            <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2"><%=.birthday %></font></td>                          </tr>                          <tr>                            <td style="border-style: solid; border-width: 1; padding-top: 0" valign="middle" align="right"><font face="Arial" size="2" color="#808080">Location:</font></td>                            <td style="border-style: solid; border-width: 1; padding-top: 0" valign="middle" align="left"><font face="Arial" size="2"><% =.state & " " &  .country %></font></td>                            <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Job Title:</font></td>                            <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2">x</font></td>                            <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Income:</font></td>                            <td style="border: 1 inset #0099FF; padding-top: 0" valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2"><%=.income%></font></td>                          </tr>                                            <tr>                              <td colspan="8" style="border-style: solid; border-color: #FFFFFF; padding-top: 0" bgcolor="#FFFFFF" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" valign="middle" align="right" class="BlueRidge">                      <p align="left"><img border="0" src="images/block.jpg" width="25" height="28"></p>                    </td>                          </tr>                  <%            End With                        Next                  End With %>            </table>    </div> --->
      <!--- NEW TABLE --->
      
          <div align="left">
            <table border="1" style="border-style: solid; border-color: #FFFFFF; padding-top: 0" cellspacing="0" cellpadding="2">
                  <tr>
                    <td colspan="6" style="border: 1 solid #000000" id="1" align="right" bgcolor="#003399">
                <p align="left"><font face="arial,helvetica,verdana,lucida,utopia " size="-1" color="white"> &nbsp;<b>User Registration Information</b></font></p>
              </td>
                  </tr>
            <center>
                  <tr> <td colspan="6" style="border: 0 solid #ffffff" id="1" align="right" bgcolor="white">&nbsp;</td></tr>
                  <tr>
                  
                  <%
                  With oPreData.UserInfo
                        .Getdata
                        For iRow = 1 to .Count
                              With .Item(iRow)
                  %>
                          <tr bgcolor="#E1e1e1">
                           <!---  <td  rowspan="4" valign="middle" align="right" class="BlueRidge">&nbsp;</td> --->
                           <td valign="middle" align="right"><font face="Arial" size="2" color="black"><b>Name:</b></font></td>
                            <td valign="middle" align="left"><font face="Arial" size="2">&nbsp;<%=.firstname & " " & .initial & " " & .lastname%></font></td>
                           <!---  <td rowspan="4" valign="middle" align="right" class="BlueRidge">&nbsp;</td> --->
                           <td valign="middle" align="right"><font face="Arial" size="2" color="black"><b>Location:</b></font></td>
                            <td valign="middle" align="left"><font face="Arial" size="2">&nbsp;<% =.state & " " &  .country %></font></td>
                                <td valign="middle" align="right"><font face="Arial" size="2" color="black"><b>Date:</b></font></td>
                            <td valign="middle" align="left" NOWRAP><font face="Arial" size="2">&nbsp;<%=.createdate %></font></td>
                          </tr>
                          <tr>
                            <td valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Gender:</font></td>
                            <td valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2">&nbsp;<%=.gender %></font></td>
                                  <td valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Job Title:</font></td>
                            <td valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2"><% =.jobTitle %></font></td>
                              
                              <td valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Referred By:</font></td>
                            <td valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2"> &nbsp;<% =.referredby%></font></td>
                         </tr>
                          <tr>
                               <td valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Birthdate:</font></td>
                            <td valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2">&nbsp;<%=.birthday %></font></td>
                            <td valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Income:</font></td>
                            <td valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2">&nbsp;<%=.income%></font></td>
                               <td valign="middle" align="right" class="BlueRidge"><font face="Arial" size="2" color="#808080">Email:</font></td>
                            <td valign="middle" align="left" class="BlueRidge"><font face="Arial" size="2">&nbsp;<%=.email%></font></td>
                          </tr>
                  
                          <tr>
                              <td colspan="8" style="border-style: solid; border-color: #FFFFFF; padding-top: 0" bgcolor="#FFFFFF" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" valign="middle" align="right" class="BlueRidge">
                      <p align="left"><img border="0" src="images/block.jpg" width="25" height="28"></p>
                    </td>
                          </tr>
                  <%            End With
                        Next
                  End With %>
            </table>
      
      <!--- END NEW TABLE --->
      
      
      
            <%  
            End If
      %> <%
            If Request("fpiTop5") = "on" Then
                  With oPreData.fpiTop5
                        .GetData CInt(iProductCategory)
                        iRowspan = .Count+1      
            %>
            <p>
            <div align="left">
            <table Border="1" bordercolor="#000000" style="border: 1 solid #FFFFFF" cellspacing="0" cellpadding="3">
                  <tr>
                    <td colspan="11" style="border: 1 solid #000000" id="1" align="right" bgcolor="#003399">
                <p align="left"><font face="arial,helvetica,verdana,lucida,utopia " size="-1" color="white"> &nbsp;<b>Top 5 FPI  Products</b></font></p>
              </td>
                  </tr>
            <center>
                  <tr> <td colspan="11" style="border: 0 solid #ffffff" id="1" align="right" bgcolor="white">&nbsp;</td></tr>
                  <tr>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" Align="center" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Today</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center"><font color="#808080">&nbsp;</font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 This Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #ffffff" id="3" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Last Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>% Change</b><br>
                  <b>this Month</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Change</b><br>
                 <b> Increases</b></font></td>
                    </tr>
            <%

                        For iRow = 1 to iRowspan-1
                              With .Item(iRow)
            %>
                              <tr>
                                <td style="border: 1 solid #000000" id="1" align="right"><font face="Arial" size="2" align="right"><%=.Today%></font></td>
            </center>
                                <td style="border: 1 solid #000000" id="1" align="right"><font face="Arial" size="2" align="right">
                        <p align="left"><%=.TodayTop5%></font></td>
                              
            <center>
                              
                                <td style="border: 1 solid #000000" id="1" align="right"><font face="Arial" size="2" align="right"><%=.ThisMonth %></font></td>
            </center>
                                <td style="border: 1 solid #000000" id="1" align="right"><font face="Arial" size="2" align="right">
                        <p align="left"><%=.ThisMonthTop5 %></font></td>
                                                            
                                <td style="border: 1 solid #000000" id="1" align="right"><font face="Arial" size="2" align="right">
                        <p align="right"><%=.LastMonth %></font></td>
                                <td style="border: 1 solid #000000" id="1" align="right"><font face="Arial" size="2" align="right">
                        <p align="left"><%=.LastMonthTop5 %></font></td>
                                                            
                                <td style="border: 1 solid #000000" id="1" align="right"><font face="Arial" size="2" align="right">
                        <p align="right"><%=oPreData.DataFormat(.Change,"#00.00") %></font></td>
                                <td style="border: 1 solid #000000" id="1" align="right"><font face="Arial" size="2" align="right">
                        <p align="left"><%=.ChangeTop5 %></font></td>
                              </tr>
            <center>
            <%
                              End With
                        Next
                  End With                        
            %>
            </table>
          </center>
    </div>
            <%

            End If
      %>
      <%
            If Request("RegisteredMembers") = "on" Then

                  %>
            <p>
            
            <div align="left">
            <img border="0" src="Charts\AgeGender.gif" WIDTH="911" HEIGHT="623">
            <table Border="1" cellpadding="3" class="BlueInset" style="border-style: solid; border-color: #FFFFFF">
            <tr>
              <td colspan="6" class="BlueRidge" style="border-style: solid; border-width: 1" bgcolor="#003399"><font face="Arial" size="2" color="white"><b>Registered
            Members</b></font></td>
            </tr>
                  <tr> <td colspan="6" style="border: 0 solid #ffffff" id="1" align="right" bgcolor="white"><font size="-3" color="Black">&nbsp;</font></td></tr>
                  <tr>
            <tr>
                <td class="BlueRidge" align="center"><font face="Arial" size="2" color="#808080">Category</font></td>
                <td class="BlueRidge" align="center"><font face="Arial" size="2" color="#808080">Total Users</font></td>
                <td class="BlueRidge" align="center"><font face="Arial" size="2" color="#808080">Registered Today</font></td>
                <td class="BlueRidge" align="center"><font face="Arial" size="2" color="#808080">Registered Last Month</font></td>
                <td class="BlueRidge" align="center"><font face="Arial" size="2" color="#808080">Registered This Month</font></td>
                <td class="BlueRidge" align="center"><font face="Arial" size="2" color="#808080">%
              Change<br>
              this Month</font></td>
              </tr>
            <%
                  With oPreData
                        .Charts.UpdateChart
                        With .Member
                              .GetData
                              For iRow = 1 to .Count
                                    With .Item(iRow)
            %>
                                    <tr>
                                      <td class="BlueRidge"><font face="Arial" size="2"><%=.categoryName%></font></td>
                                      <td class="BlueRidge" align="right"><font face="Arial" size="2"><%=.users%></font></td>
                                      <td class="BlueRidge" align="right"><font face="Arial" size="2"><%=.Today %></font></td>
                                      <td class="BlueRidge" align="right"><font face="Arial" size="2"><%=.ThisMonth %></font></td>
                                      <td class="BlueRidge" align="right"><font face="Arial" size="2"><%=.LastMonth %></font></td>
                                      <td class="BlueRidge" align="right"><font face="Arial" size="2"><%=oPreData.DataFormat(.Change,"#00.00") %></font></td>
                                    </tr>
            <%
                                    End With
                              Next
                        End With
            %>
            </table>
    </div>
            <%
                  End With
            End If
      %>
       <%
            If Request("fpiBrands") = "on" Then
                  With oPreData.fpiBrands
                        .GetData CInt(iProductCategory)
                        iRowspan = .Count+1
            %>
            <p>
            <div align="left">
            <table Border="1" cellpadding="3" height="94" class="BlueInset" style="border-style: solid; border-color: #FFFFFF">
            <tr>
              <td class="titleBar"><b>Top 5 FPI  Brands</b></font></td>
            </tr>
            <tr> <td colspan="6" style="border: 0 solid #ffffff" id="1" align="right" bgcolor="white"><font size="-3" color="Black">&nbsp;</font></td></tr>
                  
                  <tr>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" Align="center" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Today</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center"><font color="#808080">&nbsp;</font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 This Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #ffffff" id="3" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Last Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>% Change <br>this Month</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Change <br>Increases</b></font></td>
                    </tr>
            <%

                        For iRow = 1 to iRowspan-1
                              With .Item(iRow)

            %>
                              <tr>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=.Today%></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2"><%=.TodayBrand%></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=.ThisMonth %></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2"><%=.ThisMonthBrand %></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=.LastMonth %></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2"><%=.LastMonthBrand %></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=oPreData.DataFormat(.Change,"#00.00") %></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2"><%=.ChangeBrand %></font></td>
                              </tr>

            <%
                              End With
                        Next
                  End With
            %>
            </table>


    </div>


            <%
            End If
      %> <%
            If Request("fpiTypes") = "on" Then
                  With oPreData.fpiTypes
                        .GetData CInt(iProductCategory)
                        iRowspan = .Count+1

            %>
            <p>
            <div align="left">
<table Border="1" cellpadding="1" height="94" class="BlueInset" style="border-style: solid; border-color: #FFFFFF">
            <tr>
              <td bgcolor="#003399" colspan="11" class="BlueRidge" style="border: 1 solid #000000"><font face="Arial" size="2" color="white"><b>Top 5 FPI Types</b></font></td>
            </tr>
      <tr> <td colspan="6" style="border: 0 solid #ffffff" id="1" align="right" bgcolor="white"><font size="-3" color="Black">&nbsp;</font></td></tr>
                  
      <tr>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" Align="center" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Today</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center"><font color="#808080">&nbsp;</font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 This Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #ffffff" id="3" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Last Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>% Change <br>this Month</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Change <br>Increases</b></font></td>
                    </tr>
            <%

                        For iRow = 1 to iRowspan -1
                              With .Item(iRow)

            %>
                              <tr>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=.Today%></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2"><%=.TodayType%></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=.ThisMonth %></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2"><%=.ThisMonthType %></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=.LastMonth %></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2"><%=.LastMonthType %></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=oPreData.DataFormat(.Change,"#00.00")%></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2"><%=.ChangeType %></font></td>
                              </tr>

            <%
                              End With
                        Next
                  End With
            %>
            </table>


    </div>


            <%
            End If
      %>  <%

            If Request("tppTop5") = "on" Then
                  With oPreData.tppTop5
                        .GetData CInt(iProductCategory)
                        iRowspan = .Count+1
            %>
            <p>
            <div align="left">
            <table Border="1" cellpadding="3" height="94" class="BlueInset" style="border-style: solid; border-color: #FFFFFF">
            <tr>
              <td bgcolor="#003399" colspan="11" class="BlueRidge" style="border: 1 solid #000000"><font face="Arial" size="2" color="white"><b>Top 5 TPP  Products</b></font></td>
            </tr>
      <tr> <td colspan="6" style="border: 0 solid #ffffff" id="1" align="right" bgcolor="white"><font size="-3" color="Black">&nbsp;</font></td></tr>
                  
            <center>
            <tr>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" Align="center" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Today</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center"><font color="#808080">&nbsp;</font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 This Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #ffffff" id="3" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Last Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>% Change <br>this Month</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Change <br>Increases</b></font></td>
                    </tr>
                    </center>
            <%

                              For iRow = 1 to iRowspan -1
                                    With .Item(iRow)

            %>
                              <tr>
                                <td id="1" align="right" class="BlueInset"><font face="Arial" size="2" align="right"><%=.Today%></font></td>
                                <td id="1" align="right" class="BlueInset"><font face="Arial" size="2" align="right">
                        <p align="left"><%=.TodayTop5%></font></td>
                              
            <center>
                              
                                <td id="1" align="right" class="BlueInset"><font face="Arial" size="2" align="right"><%=.ThisMonth %></font></td>
            </center>
                                <td id="1" align="right" class="BlueInset"><font face="Arial" size="2" align="right">
                        <p align="left"><%=.ThisMonthTop5 %></font></td>
                                                            
                                <td id="1" align="right" class="BlueInset"><font face="Arial" size="2" align="right">
                        <p align="right"><%=.LastMonth %></font></td>
                                <td id="1" align="right" class="BlueInset"><font face="Arial" size="2" align="right">
                        <p align="left"><%=.LastMonthTop5 %></font></td>
                                                            
                                <td id="1" align="right" class="BlueInset"><font face="Arial" size="2" align="right">
                        <p align="right"><%=oPreData.DataFormat(.Change,"#00.00") %></font></td>
                                <td id="1" align="right" class="BlueInset"><font face="Arial" size="2" align="right">
                        <p align="left"><%=.ChangeTop5 %></font></td>
                              </tr>
            <center>

            <%
                                    End With
                              Next
                        End With
            %>
            </table>
          </div>
            <%
            End If
      %> <%
            If Request("tppBrands") = "on" Then
                  With oPreData.tppBrands
                        .GetData CInt(iProductCategory)            
                        iRowspan = .Count+1      

            %>
            <p>
              <div align="left">
            <table Border="1" cellpadding="3" height="94" class="BlueInset" style="border-style: solid; border-color: #FFFFFF">
            <tr>
              <td bgcolor="#003399" colspan="11" class="BlueRidge" style="border: 1 solid #000000"><font face="Arial" size="2" color="white"><b>Top 5 TPP  Brands</b></font></td>
            </tr>
      <tr> <td colspan="6" style="border: 0 solid #ffffff" id="1" align="right" bgcolor="white"><font size="-3" color="Black">&nbsp;</font></td></tr>
                  
            <center>
                  <tr>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" Align="center" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Today</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center"><font color="#808080">&nbsp;</font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 This Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #ffffff" id="3" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Last Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>% Change <br>this Month</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Change <br>Increases</b></font></td>
                    </tr>
                    </center>
            <%

                              For iRow = 1 to iRowspan - 1
                                    With .Item(iRow)

            %>
            </center>
                                    <tr>
                                      <td class="BlueRidge" height="18"><font face="Arial" size="2">
                            <p align="right"><%=.Today%></font></td>
            <center>

                                      <td class="BlueRidge" height="18"><font face="Arial" size="2"><%=.TodayBrand%></font></td>
                          </center>
                                      <td class="BlueRidge" height="18"><font face="Arial" size="2">
                            <p align="right"><%=.ThisMonth %></font></td>
            <center>

                                      <td class="BlueRidge" height="18"><font face="Arial" size="2"><%=.ThisMonthBrand %></font></td>
                          </center>
                                      <td class="BlueRidge" height="18"><font face="Arial" size="2">
                            <p align="right"><%=.LastMonth %></font></td>
            <center>

                                      <td class="BlueRidge" height="18"><font face="Arial" size="2"><%=.LastMonthBrand %></font></td>
                          </center>
                                      <td class="BlueRidge" height="18"><font face="Arial" size="2">
                            <p align="right"><%=oPreData.DataFormat(.Change,"#00.00") %></font></td>
            <center>

                                      <td class="BlueRidge" height="18"><font face="Arial" size="2"><%=.ChangeBrand %></font></td>
                                    </tr>

            <%
                                    End With
                              Next
                        End With
            %>
            </table>


          </div>


            <%
            End If
      %> <%
            If Request("tppTypes") = "on" Then
                  With oPreData.tppTypes
                        .GetData CInt(iProductCategory)                  
                        iRowspan = .Count + 1

            %>
            <p>
              <div align="left">
            <table Border="1" cellpadding="1" height="94" class="BlueInset" style="border-style: solid; border-color: #FFFFFF">
            <tr>
              <td bgcolor="#003399" colspan="11" class="BlueRidge" style="border: 1 solid #000000"><font face="Arial" size="2" color="white"><b>Top 5 TPP Types</b></font></td>
            </tr>
      <tr> <td colspan="6" style="border: 0 solid #ffffff" id="1" align="right" bgcolor="white"><font size="-3" color="Black">&nbsp;</font></td></tr>
                  
            <center>
            <tr>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" Align="center" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Today</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center"><font color="#808080">&nbsp;</font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 This Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #ffffff" id="3" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Hits</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Last Month</b></font></td>
                          <td bgcolor="#ffffff" style="border: 0 solid #000000" id="1" Rowspan="<%=iRowspan %>" align="center" class="Clear"><font color="#808080">&nbsp;</font></td>                          
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>% Change <br>this Month</b></font></td>
                      <td bgcolor="#E1E1E1" style="border: 1 solid #000000" id="1" align="center"><font face="Arial" size="2" color="black"><b>Top 5 Change <br>Increases</b></font></td>
                    </tr>
                    </center>
            <%

                        For iRow = 1 to iRowspan-1
                              With .Item(iRow)

            %>
            </center>
                              <tr>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=.Today%></font></td>
            <center>

                                <td class="BlueRidge"><font face="Arial" size="2"><%=.TodayType%></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=.ThisMonth %></font></td>
            <center>

                                <td class="BlueRidge"><font face="Arial" size="2"><%=.ThisMonthType %></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=.LastMonth %></font></td>
            <center>

                                <td class="BlueRidge"><font face="Arial" size="2"><%=.LastMonthType %></font></td>
                                <td class="BlueRidge"><font face="Arial" size="2">
                        <p align="right"><%=oPreData.DataFormat(.Change,"#00.00") %></font></td>
            <center>

                                <td class="BlueRidge"><font face="Arial" size="2"><%=.ChangeType %></font></td>
                              </tr>

            <%
                              End With
                        Next
                  End With
            %>
            </table>


        </div>


            <%
            End If
      %> <%
            Function WriteTableData()
                  With rs.Fields            
                        For iCol = 0 to .Count -1
                              Response.Write "<TH>" & .Item(iCol).Name & "</TH>"
                        Next
                        While Not rs.EOF
                              Response.Write "<TR>"
                              For iRow = 1 to .Count
                                    Response.Write "<TD>" & .Item(iRow).Value & "</TD>"
                              Next
                              Response.Write "</TR>"
                              rs.MoveNext
                        Wend
                  End With
            End Function

            Function RefreshMemberData()
                  oPreData.Member.UpdateMemberData
            End Function
            'If rs.State <> adStateClosed Then'
            '      rs.Close
            'End If
            Set rs = Nothing
            Set oPreData = Nothing
      End If
Else
      ' not authenticated
      %>
      <script LANGUAGE="JavaScript">
      alert("Login Failed - Please Reenter Username and Password")
      location = "Login2.asp"
      </script>
      
      <%
      'response.Write Request("txtAuthenticated")& "<br>" _
      '                        & Request("LoginID")& "<br>" _
      '                        & Request("Password")      
      %>
      <%
End If
      %>

                      </center>

</body>
</html>
0
 

Author Comment

by:peggasus88
Comment Utility
I will try those concepts out on Monday Jon.  
I really appreciate you taking the time to help me.
Do you happen to have an example on passing a variable to a stored procedure and storing the return @@IDENTITY value in that variable?
I'm sorry I don't have more points to give you.  If you think about it as a percentage of the points that I actually have... =) =)
0
 
LVL 6

Expert Comment

by:Jon_Raymond
Comment Utility
Here's an example - it doesn't actually use an output parameter - but it easily could.  If you were to assume that the last parameter, which uses strFormVisitors were an output parameter then this line:

.Parameters.Append .CreateParameter("@varVisitors", adVarchar, adParamInput, 50, strFormVisitors)

would actually look like this:

.Parameters.Append .CreateParameter("@varVisitors", adVarchar, adParamOutput, 50, strFormVisitors)

The only difference is the adParamOutput.  So, after the command statement is then executed the strFormVisitors output variable is changed to the output value from the query.  It's that simple.  So, you really need to use a Command object to do it.

Here's the original page - sorry for the length.  And don't worry about points.  Someone helped me - that's why I'm helping you. Anyway, this stuff is really easy for me, and will be for you too after you do it a few times.


<%@LANGUAGE="VBScript"%>
<% Response.Buffer=true %>
<% Response.Expiresabsolute = Now() - 1 %>
<% Response.AddHeader "pragma","no-cache" %>
<% Response.AddHeader "cache-control","private" %>
<% Response.CacheControl = "no-cache" %>
<!--#include file="../_includes/_dataconnect.asp" -->
<LINK rel="stylesheet" type="text/css" href="style.css">
      <%
Class clsDebug
 
 Dim blnEnabled
 Dim dteRequestTime
 Dim dteFinishTime
 Dim objStorage
 
 Public Property Get Enabled()
    Enabled = blnEnabled
 End Property
 
 Public Property Let Enabled(bNewValue)
    blnEnabled = bNewValue
 End Property
 
 Private Sub Class_Initialize()
    dteRequestTime = Now()
    Set objStorage = Server.CreateObject("Scripting.Dictionary")
 End Sub
 
 Public Sub Print(label, output)
    If Enabled then
        objStorage.Add label, output
    End if
 End Sub
 
 Public Sub [End]()
    dteFinishTime = Now()
    If Enabled then
        Response.Write "<table align=left>"
      PrintSummaryInfo()
      PrintCollection "VARIABLE STORAGE", objStorage
      PrintCollection "QUERYSTRING COLLECTION", Request.QueryString()
      PrintCollection "FORM COLLECTION", Request.Form()
      PrintCollection "COOKIES COLLECTION", Request.Cookies()
      PrintCollection "SESSION CONTENTS COLLECTION", Session.Contents()
      PrintCollection "SERVER VARIABLES COLLECTION", Request.ServerVariables()
      PrintCollection "APPLICATION CONTENTS COLLECTION", Application.Contents()
      PrintCollection "APPLICATION STATICOBJECTS COLLECTION", Application.StaticObjects()
      PrintCollection "SESSION STATICOBJECTS COLLECTION", Session.StaticObjects()
      Response.Write "</table>"
    End if
 End Sub
 
 Private Sub PrintSummaryInfo()
    With Response
     .Write("<tr align=left><td><hr></td></tr>")
     .Write("<tr><td><b>SUMMARY INFO</b></td></tr>")
     .Write("<tr><td>Time of Request = " & dteRequestTime) & "</td></tr>"
     .Write("<tr><td>Time Finished = " & dteFinishTime) & "</td></tr>"
     .Write("<tr><td>Elapsed Time = " & DateDiff("s", dteRequestTime, dteFinishTime) & " seconds</td></tr>")
     .Write("<tr><td>Request Type = " & Request.ServerVariables("REQUEST_METHOD") & "</td></tr>")
     .Write("<tr><td>Status Code = " & Response.Status & "</td></tr>")
    End With
 End Sub
 
 Private Sub PrintCollection(Byval Name, Byval Collection)
    Dim varItem
    Response.Write("<tr><td><b>" & Name & "</b></td></tr>")
    For Each varItem in Collection
      Response.Write("<tr><td>" & varItem & "=" & Collection(varItem) & "</td></tr>")
    Next
 End Sub
 
 Private Sub Class_Terminate()
    Set objStorage = Nothing
 End Sub
 
End Class
      
'========================================================================================
'== VARIABLE DEFINITIONS AND CONSTANTS
'========================================================================================

Dim cDBug
SET cDBug=NEW clsDebug
cDBug.Enabled=true

Dim strFormName
Dim strFormName2
Dim strFormCompany
Dim strFormEmail
Dim strFormPhone
Dim strFormAddress
Dim strFormAddress2
Dim strFormCity
Dim strFormState
Dim strFormCountry
Dim strFormZip
Dim strFormURL
Dim strFormPassword

strFormName = Trim(Request.Form("name"))
strFormName2 = Trim(Request.Form("name2"))
strFormCompany = Trim(Request.Form("company"))
strFormEmail = Trim(Request.Form("email"))
strFormPhone = Trim(Request.Form("phone"))
strFormAddress = Trim(Request.Form("address"))
strFormAddress2 = Trim(Request.Form("address2"))
strFormCity = Trim(Request.Form("city"))
strFormState = Trim(Request.Form("state"))
strFormCountry = Trim(Request.Form("country"))
strFormZip = Trim(Request.Form("zip"))
strFormURL = Trim(Request.Form("url"))
strFormPassword = Trim(Request.Form("password"))

If Trim(Request.Form("emaillist")) = "" then
      intFormEmailList = 0
Else
      intFormEmailList = cInt(Request.Form("emaillist"))
End If

If Trim(Request.Form("newsletter")) = "" then
      intFormNewsletter = 0
Else
intFormNewsletter = cInt(Request.Form("newsletter"))
End If
iVendorID=CInt(Request("VendorID"))
intFormSiteType = cInt(Request.Form("sitetype"))
intFormFormat = cInt(Request.Form("format"))
strFormMinCheck = Trim(Request.Form("mincheck"))
strFormTraffic = Trim(Request.Form("traffic"))
strFormVisitors = Trim(Request.Form("visitors"))
'*************************************************** debug vars
'With cDBug
'      .Print strFormName,"strFormName"
'      .Print strFormName2,"strFormName2"
'      .Print strFormCompany,"strFormCompany"
'      .Print strFormEmail,"strFormEmail"
'      .Print strFormPhone,"strFormPhone"
'      .Print strFormAddress,"strFormAddress"
'      .Print strFormAddress2,"strFormAddress2"
'      .Print strFormCity,"strFormCity"
'      .Print strFormState,"strFormState"
'      .Print strFormCountry,"strFormCountry"
'      .Print strFormZip,"strFormZip"
'      .Print strFormURL,"strFormURL"
'      .Print strFormPassword,"strFormPassword"
'      .Print intFormEmailList,"intFormEmailList"
'      .Print intFormNewsletter,"intFormNewsletter"
'      .Print iVendorID,"iVendorID"
'      .Print intFormSiteType,"intFormSiteType"
'      .Print intFormFormat,"intFormFormat"
'      .Print strFormMinCheck,"strFormMinCheck"
'      .Print strFormTraffic,"strFormTraffic"
'      .Print strFormVisitors,"strFormVisitors"
'End With      
'****************************************************

'========================================================================================
'= SET UP COMMAND OBJECT
'========================================================================================
With Cmd
      .CommandText = "spAdminVendorUpd"
      .CommandType = adCmdStoredProc
      .Name = "cmd_spAdminVendorUpd"

      '========================================================================================
      '= DEFINE INPUT Parameters (name, type, length, value)
      '========================================================================================
      .Parameters.Append .CreateParameter("@VendorID", adVarchar, adParamInput, 50, iVendorID)
      .Parameters.Append .CreateParameter("@varFName", adVarchar, adParamInput, 50, strFormName)
      .Parameters.Append .CreateParameter("@varLName", adVarchar, adParamInput, 50, strFormName2)
      .Parameters.Append .CreateParameter("@varVendorName", adVarchar, adParamInput, 50, strFormCompany)
      .Parameters.Append .CreateParameter("@varEmail", adVarchar, adParamInput, 50, strFormEmail)
      .Parameters.Append .CreateParameter("@varPhone", adVarchar, adParamInput, 50, strFormPhone)
      .Parameters.Append .CreateParameter("@varAddress", adVarchar, adParamInput, 50, strFormAddress)
      .Parameters.Append .CreateParameter("@varAddress2", adVarchar, adParamInput, 50, strFormAddress2)
      .Parameters.Append .CreateParameter("@varCity", adVarchar, adParamInput, 50, strFormCity)
      .Parameters.Append .CreateParameter("@varState", adVarchar, adParamInput, 50, strFormState)
      .Parameters.Append .CreateParameter("@varCountry", adVarchar, adParamInput, 50, strFormCountry)
      .Parameters.Append .CreateParameter("@varZip", adVarchar, adParamInput, 50, strFormZip)
      .Parameters.Append .CreateParameter("@varURL", adVarchar, adParamInput, 50, strFormURL)
      .Parameters.Append .CreateParameter("@varPassword", adVarchar, adParamInput, 50, strFormPassword)
      .Parameters.Append .CreateParameter("@varEmailList", adInteger, adParamInput, 10, intFormEmailList)
      .Parameters.Append .CreateParameter("@varNewsletter", adInteger, adParamInput, 10, intFormNewsletter)
      .Parameters.Append .CreateParameter("@varVendorTypeID", adInteger, adParamInput, 10, 2)
      .Parameters.Append .CreateParameter("@varVendorSiteTypeID", adInteger, adParamInput, 10, intFormSiteType)
      .Parameters.Append .CreateParameter("@varVendorFormatID", adInteger, adParamInput, 10, intFormFormat)
      .Parameters.Append .CreateParameter("@varMinCheck", adVarchar, adParamInput, 50, strFormMinCheck)
      .Parameters.Append .CreateParameter("@varTraffic", adVarchar, adParamInput, 50, strFormTraffic)
      .Parameters.Append .CreateParameter("@varVisitors", adVarchar, adParamInput, 50, strFormVisitors)

      '========================================================================================
      '= DEFINE OUTPUT Parameters
      '========================================================================================
      '.Parameters.Append .CreateParameter("@ReturnID", adInteger, adParamOutput, 8)
      '========================================================================================
      '= COMPLETE CONNECTION + EXECUTE
      '========================================================================================
      Set .ActiveConnection = Con
      .Execute
End With
'========================================================================================
'= DONE - Perform Cleanup and Write Output to Screen
'========================================================================================
'intReturnId = Cmd.Parameters("@ReturnId")

Set Cmd = Nothing

'Session("vendor") = intReturnId
'Response.Write Session("vendor")
'Response.Redirect "vendedit.asp?vendorid=" & iVendorID & "&vendor=" & strFormCompany



cDBug.End
SET cDBug = Nothing
Response.Write "<p class=item><a href=""vendedit.asp?vendorid=" & iVendorID & "&vendor=" & strFormCompany & """><p>"
%>
0
 
LVL 6

Expert Comment

by:Jon_Raymond
Comment Utility
Oh, it does have an output parameter - intReturnId - but that line was commented, so it may be incorrect.  The method I eplained above should work correctly.
0
 

Author Comment

by:peggasus88
Comment Utility
Wow.  My page actually works!  I'm slowly learning.  =)

2 quick question if you have some time:
-I've noticed that you and the other experts use ADO, rather than DTCs, to create data access pages.  I can see that I should get some books on ADO and ASP.  Are there any that you would recommend for a beginner?
-Is there a server-side function that retrieves the current date (month/day/year)?

I honestly couldn't have finished the page without your help.  Thanks again for your time and patience.  
0
 
LVL 6

Expert Comment

by:Jon_Raymond
Comment Utility
You can find everything you need on msdn.microsoft.com.  You should look for information on 3 ADO properties: recordset, Command, Connection.  If you look at the object browser (F2 in Visual Studio) you should find the ADODB library where you can see all the properties and subproperties.  Learn these 3 objects and how they are used.

I would also look at http://www.learnvisualstudio.net to learn VB.net since this will replace all of the ASP stuff here with slightly different libraries and properties.

Also books by Wrox or Microsoft Press are good resources.
0
 
LVL 6

Expert Comment

by:Jon_Raymond
Comment Utility
For the date use "date" or "Now"  Thanks.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now