DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Re: Recordset.MoveNext - Martha again (shoot me !!..ha)

  1. #1
    martha Guest

    Re: Recordset.MoveNext - Martha again (shoot me !!..ha)


    well..ok..mm..every one is new from the beginning, so was I..long time ago
    <heheee..>

    i tried to use Visual InterDev and put the code inside there..
    ( the nested codes..well ..it's recordset's DTC.. so don't need to look at
    too seriously..it's just drop/pull.. nothing special)
    pay attention on "<TABLE>"

    ***************************
    <%@ Language=VBScript %>
    <% ' VI 6.0 Scripting Object Model Enabled %>
    <!--#include file="_ScriptLibrary/pm.asp"-->
    <% if StartPageProcessing() Then Response.End() %>
    <FORM name=thisForm METHOD=post>
    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    </HEAD>
    <BODY>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT id=Recordset1 style="LEFT: 0px; TOP: 0px" classid="clsid:9CF5D7C2-EC10-11D0-9862-0000F8027CA0">
    <PARAM NAME="ExtentX" VALUE="12197">
    <PARAM NAME="ExtentY" VALUE="2090">
    <PARAM NAME="State" VALUE="(TCConn=\qConnection1\q,TCDBObject=\qTables\q,TCDBObjectName=\qRank\q,TCControlID_U nmatched=\qRecordset1\q,TCPPConn=\qConnection1\q,RCDBObject=\qRCDBObject\q,TCPPDBObject=\q Tables\q,TCPPDBObjectName=\qRank\q,TCCursorType=\q3\s-\
    sStatic\q,TCCursorLocation=\q3\s-\sUse\sclient-side\scursors\q,TCLockType=\q3\s-\sOptimistic\q,TCCacheSize_Unmatched=\q10\q,TCCommTimeout_Unmatched=\q10\q,CCPrepared=0,CC AllRecords=1,TCNRecords_Unmatched=\q10\q,TCODBCSyntax_Unmatched=\q\q,TCHTargetPlatform
    =\q\q,TCHTargetBrowser_Unmatched=\qServer\s(ASP)\q,TCTargetPlatform=\qInherit\sfrom\spage\ q,RCCache=\qRCBookPage\q,CCOpen=1,GCParameters=(Rows=0))"></OBJECT>
    -->
    <!--#INCLUDE FILE="_ScriptLibrary/Recordset.ASP"-->
    <SCRIPT LANGUAGE="JavaScript" RUNAT="server">
    function _initRecordset1()
    {
    var DBConn = Server.CreateObject('ADODB.Connection');
    DBConn.ConnectionTimeout = Application('Connection1_ConnectionTimeout');
    DBConn.CommandTimeout = Application('Connection1_CommandTimeout');
    DBConn.CursorLocation = Application('Connection1_CursorLocation');
    DBConn.Open(Application('Connection1_ConnectionString'), Application('Connection1_RuntimeUserName'),
    Application('Connection1_RuntimePassword'));
    var cmdTmp = Server.CreateObject('ADODB.Command');
    var rsTmp = Server.CreateObject('ADODB.Recordset');
    cmdTmp.ActiveConnection = DBConn;
    rsTmp.Source = cmdTmp;
    cmdTmp.CommandType = 2;
    cmdTmp.CommandTimeout = 10;
    cmdTmp.CommandText = '`Rank`';
    rsTmp.CacheSize = 10;
    rsTmp.CursorType = 3;
    rsTmp.CursorLocation = 3;
    rsTmp.LockType = 3;
    Recordset1.setRecordSource(rsTmp);
    Recordset1.open();
    if (thisPage.getState('pb_Recordset1') != null)
    Recordset1.setBookmark(thisPage.getState('pb_Recordset1'));
    }
    function _Recordset1_ctor()
    {
    CreateRecordset('Recordset1', _initRecordset1, null);
    }
    function _Recordset1_dtor()
    {
    Recordset1._preserveState();
    thisPage.setState('pb_Recordset1', Recordset1.getBookmark());
    }
    </SCRIPT>

    <!--METADATA TYPE="DesignerControl" endspan-->
    <P>&nbsp;</P>
    <TABLE BORDER=1>
    <TR>
    <TH>ID</TH>
    <TH>SaliorID</TH>
    <TH>Year</TH>
    <TH>Month</TH>
    <TH>Rank</TH>
    </TR>
    <%
    Do While NOT Recordset1.EOF
    Response.Write "<TR><TD>"&_
    Recordset1.fields.getValue("ID")&_
    "</TD>"
    Response.Write "<TD>" &_
    Recordset1.fields.getValue("SailorID")&_
    "</TD>"
    Response.Write "<TD>" &_
    Recordset1.fields.getValue("Year")&_
    "</TD>"
    Response.Write "<TD>" &_
    Recordset1.fields.getValue("Month")&_
    "</TD>"
    Response.Write "<TD>" &_
    Recordset1.fields.getValue("Rank")&_
    "</TD></TR>"
    Recordset1.moveNext
    Loop
    %>
    </TABLE>
    </BODY>
    <% ' VI 6.0 Scripting Object Model Enabled %>
    <% EndPageProcessing() %>
    </FORM>
    </HTML>
    ****************************************************
    NOW...mm..^__^* forget what i said before.. look at the table...

    <TABLE BORDER=1>
    <TR>
    <TH>ID</TH>
    <TH>SaliorID</TH>
    <TH>Year</TH>
    <TH>Month</TH>
    <TH>Rank</TH>
    </TR>
    <%
    Do While NOT Recordset1.EOF
    Response.Write "<TR><TD>"&_
    Recordset1.fields.getValue("ID")&_
    "</TD>"
    Response.Write "<TD>" &_
    Recordset1.fields.getValue("SailorID")&_
    "</TD>"
    Response.Write "<TD>" &_
    Recordset1.fields.getValue("Year")&_
    "</TD>"
    Response.Write "<TD>" &_
    Recordset1.fields.getValue("Month")&_
    "</TD>"
    Response.Write "<TD>" &_
    Recordset1.fields.getValue("Rank")&_
    "</TD></TR>"
    Recordset1.moveNext
    Loop
    %>
    </TABLE>
    ***********************************************
    there are 5 fields(columns) -- ID, SoliarID, Year, Month, Rank
    see
    <Table>
    <%
    Do While NOT Recordset1.EOF --> ur should be ProductRecordset.EOF
    ...
    ...
    Recordset1.moveNext--> urs "ProductRecordset.moveNext"
    Loop
    %>
    </Table>
    so... ur ProductRecordset.moveNext and Loop
    should include inside the table
    other stuffs code, just let the Visual InterDev takes care of the rest.

    mmm.. well and the morning's code is simply the ASP not involve the Visual
    InterDev.. those also work fine from my computer. thanks God, not crash at
    all!! even this one ..man.. scared me! shoot~~ gzz

    also, i didn't use the ProductRecordset.moveFirst, mine is Recordset1.moveFirst..

    hope this help again. ^___^**

    martha.
    p.s. try to use the Recordset.fields.getValue("FieldName")


  2. #2
    nalod Guest

    Re: Recordset.MoveNext - Martha again (shoot me !!..ha)


    Hi Martha,

    Forgive me for bothering you again. I see your code below but am not sure
    where exactly to put it. My page is as follows Its the ResellerRecordset
    (had to change) that may have many records and that is printing out multiples
    of the same record.

    Tks
    nalod

    <%@ Language=VBScript %>
    <% ' VI 6.0 Scripting Object Model Enabled %>
    <!--#include file="_ScriptLibrary/pm.asp"-->
    <% if StartPageProcessing() Then Response.End() %>
    <FORM name=thisForm METHOD=post>
    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    </HEAD>
    <BODY>
    <P align=center><FONT size=4><STRONG>Contract
    Information</STRONG></FONT></P>
    <P align=center><STRONG><FONT size=4>&nbsp;</P>
    <P align=left><!--#INCLUDE FILE="_ScriptLibrary/Recordset.ASP"-->
    <SCRIPT LANGUAGE="JavaScript" RUNAT="server">
    function _initContractRecordset()
    {
    var ContractID = Request.QueryString("ContractID");
    var DBConn = Server.CreateObject('ADODB.Connection');
    DBConn.ConnectionTimeout = Application('Connection1_ConnectionTimeout');
    DBConn.CommandTimeout = Application('Connection1_CommandTimeout');
    DBConn.CursorLocation = Application('Connection1_CursorLocation');
    DBConn.Open(Application('Connection1_ConnectionString'), Application('Connection1_RuntimeUserName'),
    Application('Connection1_RuntimePassword'));
    var cmdTmp = Server.CreateObject('ADODB.Command');
    var rsTmp = Server.CreateObject('ADODB.Recordset');
    cmdTmp.ActiveConnection = DBConn;
    rsTmp.Source = cmdTmp;
    cmdTmp.CommandType = 1;
    cmdTmp.CommandTimeout = 10;
    cmdTmp.CommandText = "SELECT `Schedule Tracking`.`Contract Number`, `Schedule
    Tracking`.`Customer Name`, `Schedule Tracking`.Country, `Schedule Tracking`.TimeReceived,
    `Schedule Tracking`.DateReceived FROM `Schedule Tracking`, ResellerData WHERE
    [Schedule Tracking].[Contract Number] = '" +ContractID+ "'" ;
    rsTmp.CacheSize = 10;
    rsTmp.CursorType = 3;
    rsTmp.CursorLocation = 3;
    rsTmp.LockType = 3;
    ContractRecordset.setRecordSource(rsTmp);
    ContractRecordset.open();
    if (thisPage.getState('pb_ContractRecordset') != null)
    ContractRecordset.setBookmark(thisPage.getState('pb_ContractRecordset'));
    }
    function _ContractRecordset_ctor()
    {
    CreateRecordset('ContractRecordset', _initContractRecordset, null);
    }
    function _ContractRecordset_dtor()
    {
    ContractRecordset._preserveState();
    thisPage.setState('pb_ContractRecordset', ContractRecordset.getBookmark());
    }
    </SCRIPT>

    </P>
    <P align=center>
    <TABLE border=1 align=center cellPadding=1 cellSpacing=1 width="75%">

    <TR>
    <TD><STRONG>Contract<BR>Number</STRONG></TD>
    <TD><STRONG>Customer<BR>Name</STRONG></TD>
    <TD><STRONG>Country</STRONG></TD>
    <TD><STRONG>Date<BR>Received</STRONG></TD>
    <TD><STRONG>Time<BR>Received</STRONG></TD></TR>
    <TR>
    <TD><STRONG><FONT size=4>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17
    id=Label1 style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 86px" width=86>
    <PARAM NAME="_ExtentX" VALUE="2275">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label1">
    <PARAM NAME="DataSource" VALUE="ContractRecordset">
    <PARAM NAME="DataField" VALUE="Contract Number">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">


    </OBJECT>
    -->
    <!--#INCLUDE FILE="_ScriptLibrary/Label.ASP"-->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel1()
    {
    Label1.setDataSource(ContractRecordset);
    Label1.setDataField('Contract Number');
    }
    function _Label1_ctor()
    {
    CreateLabel('Label1', _initLabel1, null);
    }
    </script>
    <% Label1.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </FONT></STRONG></TD>
    <TD>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17
    id=Label2 style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 80px" width=80>
    <PARAM NAME="_ExtentX" VALUE="2117">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label2">
    <PARAM NAME="DataSource" VALUE="ContractRecordset">
    <PARAM NAME="DataField" VALUE="Customer Name">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">

    </OBJECT>
    -->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel2()
    {
    Label2.setDataSource(ContractRecordset);
    Label2.setDataField('Customer Name');
    }
    function _Label2_ctor()
    {
    CreateLabel('Label2', _initLabel2, null);
    }
    </script>
    <% Label2.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </TD>
    <TD>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17
    id=Label3 style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 71px" width=71>
    <PARAM NAME="_ExtentX" VALUE="1879">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label3">
    <PARAM NAME="DataSource" VALUE="ContractRecordset">
    <PARAM NAME="DataField" VALUE="DateReceived">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">

    </OBJECT>
    -->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel3()
    {
    Label3.setDataSource(ContractRecordset);
    Label3.setDataField('DateReceived');
    }
    function _Label3_ctor()
    {
    CreateLabel('Label3', _initLabel3, null);
    }
    </script>
    <% Label3.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </TD>
    <TD>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17
    id=Label4 style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 70px" width=70>
    <PARAM NAME="_ExtentX" VALUE="1852">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label4">
    <PARAM NAME="DataSource" VALUE="ContractRecordset">
    <PARAM NAME="DataField" VALUE="TimeReceived">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">

    </OBJECT>
    -->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel4()
    {
    Label4.setDataSource(ContractRecordset);
    Label4.setDataField('TimeReceived');
    }
    function _Label4_ctor()
    {
    CreateLabel('Label4', _initLabel4, null);
    }
    </script>
    <% Label4.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </TD>
    <TD>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17
    id=Label5 style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 43px" width=43>
    <PARAM NAME="_ExtentX" VALUE="1138">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label5">
    <PARAM NAME="DataSource" VALUE="ContractRecordset">
    <PARAM NAME="DataField" VALUE="Country">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">

    </OBJECT>
    -->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel5()
    {
    Label5.setDataSource(ContractRecordset);
    Label5.setDataField('Country');
    }
    function _Label5_ctor()
    {
    CreateLabel('Label5', _initLabel5, null);
    }
    </script>
    <% Label5.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </TD></TR></TABLE></P>
    <P align=left><!--#INCLUDE FILE="_ScriptLibrary/Recordset.ASP"-->
    <SCRIPT LANGUAGE="JavaScript" RUNAT="server">
    function _initResellerRecordset()
    {
    var ContractID = Request.QueryString("ContractID");
    var DBConn = Server.CreateObject('ADODB.Connection');
    DBConn.ConnectionTimeout = Application('Connection1_ConnectionTimeout');
    DBConn.CommandTimeout = Application('Connection1_CommandTimeout');
    DBConn.CursorLocation = Application('Connection1_CursorLocation');
    DBConn.Open(Application('Connection1_ConnectionString'), Application('Connection1_RuntimeUserName'),
    Application('Connection1_RuntimePassword'));
    var cmdTmp = Server.CreateObject('ADODB.Command');
    var rsTmp = Server.CreateObject('ADODB.Recordset');
    cmdTmp.ActiveConnection = DBConn;
    rsTmp.Source = cmdTmp;
    cmdTmp.CommandType = 1;
    cmdTmp.CommandTimeout = 10;
    cmdTmp.CommandText = "SELECT ResellerData.Reseller, ResellerData.AmountFundedNet,
    ResellerData.AmountFundedVAT, ResellerData.AmountFundedTotal, ResellerData.DateFunded,
    ResellerData.Notified, `Schedule Tracking`.`Contract Number`, `Schedule Tracking`.`Currency`
    FROM `Schedule Tracking`, ResellerData WHERE ResellerData.`Contract Number`
    = '" +ContractID+ "'" ;
    rsTmp.CacheSize = 10;
    rsTmp.CursorType = 3;
    rsTmp.CursorLocation = 3;
    rsTmp.LockType = 3;
    ResellerRecordset.setRecordSource(rsTmp);
    ResellerRecordset.open();
    if (thisPage.getState('pb_ResellerRecordset') != null)
    ResellerRecordset.setBookmark(thisPage.getState('pb_ResellerRecordset'));
    }
    function _ResellerRecordset_ctor()
    {
    CreateRecordset('ResellerRecordset', _initResellerRecordset, null);
    }
    function _ResellerRecordset_dtor()
    {
    ResellerRecordset._preserveState();
    thisPage.setState('pb_ResellerRecordset', ResellerRecordset.getBookmark());
    }
    </SCRIPT>

    </P>
    <P align=left>
    <TABLE border=1 align=center cellPadding=1 cellSpacing=1 width="75%">

    <TR>
    <TD><STRONG>Reseller</STRONG></TD>
    <TD><STRONG>Amount<BR>Funded<BR>Net</STRONG></TD>
    <TD><STRONG>Amount<BR>Funded<BR>Vat</STRONG></TD>
    <TD><STRONG>Amount<BR>Funded<BR>Total</STRONG></TD>
    <TD><STRONG>Date<BR>Funded</STRONG></TD>
    <TD><STRONG>Reseller<BR>Notified</STRONG></TD>
    <TD><STRONG>Currency</STRONG></TD></TR>
    <TR>
    <TD>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17
    id=Label6 style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 42px" width=42>
    <PARAM NAME="_ExtentX" VALUE="1111">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label6">
    <PARAM NAME="DataSource" VALUE="ResellerRecordset">
    <PARAM NAME="DataField" VALUE="Reseller">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">

    </OBJECT>
    -->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel6()
    {
    Label6.setDataSource(ResellerRecordset);
    Label6.setDataField('Reseller');
    }
    function _Label6_ctor()
    {
    CreateLabel('Label6', _initLabel6, null);
    }
    </script>
    <% Label6.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </TD>
    <TD>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17
    id=Label7 style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 94px" width=94>
    <PARAM NAME="_ExtentX" VALUE="2487">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label7">
    <PARAM NAME="DataSource" VALUE="ResellerRecordset">
    <PARAM NAME="DataField" VALUE="AmountFundedNet">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">

    </OBJECT>
    -->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel7()
    {
    Label7.setDataSource(ResellerRecordset);
    Label7.setDataField('AmountFundedNet');
    }
    function _Label7_ctor()
    {
    CreateLabel('Label7', _initLabel7, null);
    }
    </script>
    <% Label7.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </TD>
    <TD>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17
    id=Label8 style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 96px" width=96>
    <PARAM NAME="_ExtentX" VALUE="2540">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label8">
    <PARAM NAME="DataSource" VALUE="ResellerRecordset">
    <PARAM NAME="DataField" VALUE="AmountFundedVAT">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">

    </OBJECT>
    -->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel8()
    {
    Label8.setDataSource(ResellerRecordset);
    Label8.setDataField('AmountFundedVAT');
    }
    function _Label8_ctor()
    {
    CreateLabel('Label8', _initLabel8, null);
    }
    </script>
    <% Label8.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </TD>
    <TD>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17
    id=Label9 style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 101px"
    width=101>
    <PARAM NAME="_ExtentX" VALUE="2672">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label9">
    <PARAM NAME="DataSource" VALUE="ResellerRecordset">
    <PARAM NAME="DataField" VALUE="AmountFundedTotal">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">

    </OBJECT>
    -->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel9()
    {
    Label9.setDataSource(ResellerRecordset);
    Label9.setDataField('AmountFundedTotal');
    }
    function _Label9_ctor()
    {
    CreateLabel('Label9', _initLabel9, null);
    }
    </script>
    <% Label9.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </TD>
    <TD>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17
    id=Label10 style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 63px"
    width=63>
    <PARAM NAME="_ExtentX" VALUE="1667">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label10">
    <PARAM NAME="DataSource" VALUE="ResellerRecordset">
    <PARAM NAME="DataField" VALUE="DateFunded">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">

    </OBJECT>
    -->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel10()
    {
    Label10.setDataSource(ResellerRecordset);
    Label10.setDataField('DateFunded');
    }
    function _Label10_ctor()
    {
    CreateLabel('Label10', _initLabel10, null);
    }
    </script>
    <% Label10.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </TD>
    <TD>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17
    id=Label11 style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 41px"
    width=41>
    <PARAM NAME="_ExtentX" VALUE="1085">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label11">
    <PARAM NAME="DataSource" VALUE="ResellerRecordset">
    <PARAM NAME="DataField" VALUE="Notified">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">

    </OBJECT>
    -->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel11()
    {
    Label11.setDataSource(ResellerRecordset);
    Label11.setDataField('Notified');
    }
    function _Label11_ctor()
    {
    CreateLabel('Label11', _initLabel11, null);
    }
    </script>
    <% Label11.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </TD>
    <TD>
    <!--METADATA TYPE="DesignerControl" startspan
    <OBJECT classid="clsid:B5F0E460-DC5F-11D0-9846-0000F8027CA0" height=17 id=Label12
    style="HEIGHT: 17px; LEFT: 0px; TOP: 0px; WIDTH: 48px"
    width=48>
    <PARAM NAME="_ExtentX" VALUE="1270">
    <PARAM NAME="_ExtentY" VALUE="450">
    <PARAM NAME="id" VALUE="Label12">
    <PARAM NAME="DataSource" VALUE="ResellerRecordset">
    <PARAM NAME="DataField" VALUE="Currency">
    <PARAM NAME="FontFace" VALUE="">
    <PARAM NAME="FontSize" VALUE="">
    <PARAM NAME="FontColor" VALUE="">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="FormatAsHTML" VALUE="0">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE=""></OBJECT>
    -->
    <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
    function _initLabel12()
    {
    Label12.setDataSource(ResellerRecordset);
    Label12.setDataField('Currency');
    }
    function _Label12_ctor()
    {
    CreateLabel('Label12', _initLabel12, null);
    }
    </script>
    <% Label12.display %>

    <!--METADATA TYPE="DesignerControl" endspan-->
    </TD></TR></TABLE></P>
    <P align=left>

    </P>
    <P>&nbsp;</P>
    <P></FONT></STRONG>&nbsp;</P>

    </BODY>
    <% ' VI 6.0 Scripting Object Model Enabled %>
    <% EndPageProcessing() %>
    </FORM>
    </HTML>
    >
    >well..ok..mm..every one is new from the beginning, so was I..long time ago
    ><heheee..>
    >
    >i tried to use Visual InterDev and put the code inside there..
    >( the nested codes..well ..it's recordset's DTC.. so don't need to look

    at
    >too seriously..it's just drop/pull.. nothing special)
    >pay attention on "<TABLE>"
    >
    >***************************
    ><%@ Language=VBScript %>
    ><% ' VI 6.0 Scripting Object Model Enabled %>
    ><!--#include file="_ScriptLibrary/pm.asp"-->
    ><% if StartPageProcessing() Then Response.End() %>
    ><FORM name=thisForm METHOD=post>
    ><HTML>
    ><HEAD>
    ><META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    ></HEAD>
    ><BODY>
    ><!--METADATA TYPE="DesignerControl" startspan
    ><OBJECT id=Recordset1 style="LEFT: 0px; TOP: 0px" classid="clsid:9CF5D7C2-EC10-11D0-9862-0000F8027CA0">
    > <PARAM NAME="ExtentX" VALUE="12197">
    > <PARAM NAME="ExtentY" VALUE="2090">
    > <PARAM NAME="State" VALUE="(TCConn=\qConnection1\q,TCDBObject=\qTables\q,TCDBObjectName=\qRank\q,TCControlID_U nmatched=\qRecordset1\q,TCPPConn=\qConnection1\q,RCDBObject=\qRCDBObject\q,TCPPDBObject=\q Tables\q,TCPPDBObjectName=\qRank\q,TCCursorType=\q3\s-

    \sStatic\q,TCCursorLocation=\q3\s-\sUse\sclient-side\scursors\q,TCLockType=\q3\s-\sOptimistic\q,TCCacheSize_Unmatched=\q10\q,TCCommTimeout_Unmatched=\q10\q,CCPrepared=0,CC AllRecords=1,TCNRecords_Unmatched=\q10\q,TCODBCSyntax_Unmatched=\q\q,TCHTa
    >rgetPlatform=\q\q,TCHTargetBrowser_Unmatched=\qServer\s(ASP)\q,TCTargetPlatform=\qInherit \sfrom\spage\q,RCCache=\qRCBookPage\q,CCOpen=1,GCParameters=(Rows=0))"></OBJECT>
    >-->
    ><!--#INCLUDE FILE="_ScriptLibrary/Recordset.ASP"-->
    ><SCRIPT LANGUAGE="JavaScript" RUNAT="server">
    >function _initRecordset1()
    >{
    > var DBConn = Server.CreateObject('ADODB.Connection');
    > DBConn.ConnectionTimeout = Application('Connection1_ConnectionTimeout');
    > DBConn.CommandTimeout = Application('Connection1_CommandTimeout');
    > DBConn.CursorLocation = Application('Connection1_CursorLocation');
    > DBConn.Open(Application('Connection1_ConnectionString'), Application('Connection1_RuntimeUserName'),
    >Application('Connection1_RuntimePassword'));
    > var cmdTmp = Server.CreateObject('ADODB.Command');
    > var rsTmp = Server.CreateObject('ADODB.Recordset');
    > cmdTmp.ActiveConnection = DBConn;
    > rsTmp.Source = cmdTmp;
    > cmdTmp.CommandType = 2;
    > cmdTmp.CommandTimeout = 10;
    > cmdTmp.CommandText = '`Rank`';
    > rsTmp.CacheSize = 10;
    > rsTmp.CursorType = 3;
    > rsTmp.CursorLocation = 3;
    > rsTmp.LockType = 3;
    > Recordset1.setRecordSource(rsTmp);
    > Recordset1.open();
    > if (thisPage.getState('pb_Recordset1') != null)
    > Recordset1.setBookmark(thisPage.getState('pb_Recordset1'));
    >}
    >function _Recordset1_ctor()
    >{
    > CreateRecordset('Recordset1', _initRecordset1, null);
    >}
    >function _Recordset1_dtor()
    >{
    > Recordset1._preserveState();
    > thisPage.setState('pb_Recordset1', Recordset1.getBookmark());
    >}
    ></SCRIPT>
    >
    ><!--METADATA TYPE="DesignerControl" endspan-->
    ><P> </P>
    ><TABLE BORDER=1>
    ><TR>
    ><TH>ID</TH>
    ><TH>SaliorID</TH>
    ><TH>Year</TH>
    ><TH>Month</TH>
    ><TH>Rank</TH>
    ></TR>
    ><%
    >Do While NOT Recordset1.EOF
    >Response.Write "<TR><TD>"&_
    >Recordset1.fields.getValue("ID")&_
    >"</TD>"
    >Response.Write "<TD>" &_
    >Recordset1.fields.getValue("SailorID")&_
    >"</TD>"
    >Response.Write "<TD>" &_
    >Recordset1.fields.getValue("Year")&_
    >"</TD>"
    >Response.Write "<TD>" &_
    >Recordset1.fields.getValue("Month")&_
    >"</TD>"
    >Response.Write "<TD>" &_
    >Recordset1.fields.getValue("Rank")&_
    >"</TD></TR>"
    >Recordset1.moveNext
    >Loop
    >%>
    ></TABLE>
    ></BODY>
    ><% ' VI 6.0 Scripting Object Model Enabled %>
    ><% EndPageProcessing() %>
    ></FORM>
    ></HTML>
    >****************************************************
    >NOW...mm..^__^* forget what i said before.. look at the table...
    >
    ><TABLE BORDER=1>
    ><TR>
    ><TH>ID</TH>
    ><TH>SaliorID</TH>
    ><TH>Year</TH>
    ><TH>Month</TH>
    ><TH>Rank</TH>
    ></TR>
    ><%
    >Do While NOT Recordset1.EOF
    >Response.Write "<TR><TD>"&_
    >Recordset1.fields.getValue("ID")&_
    >"</TD>"
    >Response.Write "<TD>" &_
    >Recordset1.fields.getValue("SailorID")&_
    >"</TD>"
    >Response.Write "<TD>" &_
    >Recordset1.fields.getValue("Year")&_
    >"</TD>"
    >Response.Write "<TD>" &_
    >Recordset1.fields.getValue("Month")&_
    >"</TD>"
    >Response.Write "<TD>" &_
    >Recordset1.fields.getValue("Rank")&_
    >"</TD></TR>"
    >Recordset1.moveNext
    >Loop
    >%>
    ></TABLE>
    >***********************************************
    >there are 5 fields(columns) -- ID, SoliarID, Year, Month, Rank
    >see
    ><Table>
    ><%
    >Do While NOT Recordset1.EOF --> ur should be ProductRecordset.EOF
    >...
    >...
    >Recordset1.moveNext--> urs "ProductRecordset.moveNext"
    >Loop
    >%>
    ></Table>
    >so... ur ProductRecordset.moveNext and Loop
    >should include inside the table
    >other stuffs code, just let the Visual InterDev takes care of the rest.
    >
    >mmm.. well and the morning's code is simply the ASP not involve the Visual
    >InterDev.. those also work fine from my computer. thanks God, not crash

    at
    >all!! even this one ..man.. scared me! shoot~~ gzz
    >
    >also, i didn't use the ProductRecordset.moveFirst, mine is Recordset1.moveFirst..
    >
    >hope this help again. ^___^**
    >
    >martha.
    >p.s. try to use the Recordset.fields.getValue("FieldName")
    >



  3. #3
    Hans Brederode Guest

    Re: Recordset.MoveNext - Martha again (shoot me !!..ha)


    Hi Nalod,

    just read your discussion with Martha about the Movenext, imho the mistake
    doesn't lie in the way you walk the recordset, but in the sql-query you build
    it with.
    Somewhere in the script I read the following piece:
    cmdTmp.CommandText = "SELECT ResellerData.Reseller, ResellerData.AmountFundedNet,
    ResellerData.AmountFundedVAT, ResellerData.AmountFundedTotal, ResellerData.DateFunded,
    ResellerData.Notified, `Schedule Tracking`.`Contract Number`, `Schedule Tracking`.`Currency`
    FROM `Schedule Tracking`, ResellerData WHERE ResellerData.`Contract Number`
    = '" +ContractID+ "'" ;

    The one thing I'm missing here is how the two tables (Schedule Tracking and
    Resellerdata) are joined, like 'Schedule Tracking'.'Contract Number'=Resellerdata.'Contract
    Number'. The way the query is built, my guess is that for each record in
    the Schedule Tracking table, you get each record in the ResellerData table
    where the Contract Number equals the ContractID. That way you'll probably
    get more hits than you bargained for.

    I think the Where clause should read:
    WHERE ('Schedule Tracking'.'Contract Number'=ResellerData.'Contract Number')
    AND (ResellerData.'Contract Number'='" + ContractID + "')"

    In the other SQL-query I found there's also no 'join' between the tables

    HTH

    Hans



  4. #4
    Chris Guest

    Re: Recordset.MoveNext - Martha again (shoot me !!..ha)


    I think you've hit the nail on the head here Hans, definitely worth investigating
    Nalod... poor guys gone from a v. simple ASP stepping through a recordset
    to a multi-page discussion on complex DTCs, paged recordsets, etc, jhust
    complicating the issue...
    Chris

    "Hans Brederode" <hans@radical.nl> wrote:
    >
    >Hi Nalod,
    >
    >just read your discussion with Martha about the Movenext, imho the mistake
    >doesn't lie in the way you walk the recordset, but in the sql-query you

    build
    >it with.
    >Somewhere in the script I read the following piece:
    >cmdTmp.CommandText = "SELECT ResellerData.Reseller, ResellerData.AmountFundedNet,
    >ResellerData.AmountFundedVAT, ResellerData.AmountFundedTotal, ResellerData.DateFunded,
    >ResellerData.Notified, `Schedule Tracking`.`Contract Number`, `Schedule

    Tracking`.`Currency`
    >FROM `Schedule Tracking`, ResellerData WHERE ResellerData.`Contract Number`
    >= '" +ContractID+ "'" ;
    >
    >The one thing I'm missing here is how the two tables (Schedule Tracking

    and
    >Resellerdata) are joined, like 'Schedule Tracking'.'Contract Number'=Resellerdata.'Contract
    >Number'. The way the query is built, my guess is that for each record in
    >the Schedule Tracking table, you get each record in the ResellerData table
    >where the Contract Number equals the ContractID. That way you'll probably
    >get more hits than you bargained for.
    >
    >I think the Where clause should read:
    >WHERE ('Schedule Tracking'.'Contract Number'=ResellerData.'Contract Number')
    >AND (ResellerData.'Contract Number'='" + ContractID + "')"
    >
    >In the other SQL-query I found there's also no 'join' between the tables
    >
    >HTH
    >
    >Hans
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center