Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Code Help Recordset values

Reply
Thread Tools

Code Help Recordset values

 
 
ferky
Guest
Posts: n/a
 
      09-10-2004
I have this code below when I asign strOldTkinit = strNewTkinit and
then read the new value for the strNewTkinit from the recordset the
strOldTkinit changes the value also. So when I run my comparison the
values is always equal even though I read a new value from the
recordset. Please help.


function getRSXML(strSQL) {
var adoCnn = null;
var adoRst = null;
var strRst = null;
var strReturn = null;
var i=0;
var intPeriod = null;
var intRange = null;
var intPeriodTotal = null;
var intRangeTotal = null;
var intValue = 0;
var strNewTkinit = "";
var strOldTkinit = "";
var strTkName = null;
var strPeriod = 0;
var numberTimes = 0;

strReturn = "";

try {
adoCnn = new ActiveXObject("Webview.clsDatalayer");
adoRst = new ActiveXObject("ADODB.Recordset");


adoRst = adoCnn.Get_RecordSet(strSQL);
//Get the <STATS> Info
strReturn += '<STATS>';
while ((adoRst.EOF == false) && (adoRst.BOF == false)) {


strPeriod = adoRst(2);
intValue = adoRst(5);
if (strNewTkinit == strOldTkinit)
{
//strOldTkinit == strNewTkinit;
//Same timekeeper perform calculations
if (strPeriod == '0804'){ //should be a variable for current
period
intPeriod = intValue;
}
else{
intRange += intValue;
}


}
else // strOldTkinit == strNewTkinit;
{

if (numberTimes == 0)
{
numberTimes ++; // Never again
//strOldTkinit = strNewTkinit;

strTkName = adoRst(3) + ' ' + adoRst(4);

//Same timekeeper perform calculations
if (strPeriod == '0804'){ //should be a variable for current
period
intPeriod = intValue;
}
else{
intRange += intValue;
}

}
else
{
//If new timekeeper print current line
i++;
strReturn += '<z r=\"'+ i +'\" c1=\"'+ strOldTkinit +'\"
c2=\"'+ strTkName +'\" c3=\"'+ intPeriod +'\" c4=\"'+ intRange +'\"
/>';

//Calculate values for the <STATSFOOTER>
intPeriodTotal += intPeriod;
intRangeTotal += intRange;

//strOldTkinit = strNewTkinit;
trTkName = adoRst(3) + ' ' + adoRst(4);

if (strPeriod == '0804'){ //should be a variable for current
period
intPeriod = intValue;
}
else{
intRange += intValue;
}

}

}


adoRst.movenext;
strOldTkinit = strNewTkinit;

}

i++;
strReturn += '<z r=\"'+ i +'\" c1=\"'+ strOldTkinit +'\" c2=\"'+
strTkName +'\" c3=\"'+ intPeriod +'\" c4=\"'+ intRange +'\" />';

//Calculate values for the <STATSFOOTER>
intPeriodTotal += intPeriod;
intRangeTotal += intRange;

strReturn += '</STATS><STATSFOOTER>';
//<z r="397" c1="" c2="GRAND TOTAL" c3="-7169.50"
c4="175414250.54" />
strReturn += '<z r=\"'+ numberTimes +'\" c1=\"\" c2=\"GRAND TOTAL\"
c3=\"'+ intPeriodTotal +'\" c4=\"'+ intRangeTotal +'\" />';
strReturn += '</STATSFOOTER>';


} catch (DBErr) {
strReturn = "DBErr" + DBErr.message;
} finally {
try {
adoRst.Close();
} catch (CloseErr){}

adoCnn = null;
adoRst = null;
strRst = null;
}
return strReturn;
}
 
Reply With Quote
 
 
 
 
kaeli
Guest
Posts: n/a
 
      09-13-2004
In article <(E-Mail Removed) >,
http://www.velocityreviews.com/forums/(E-Mail Removed) enlightened us with...
> I have this code below when I asign strOldTkinit = strNewTkinit and
> then read the new value for the strNewTkinit from the recordset the
> strOldTkinit changes the value also. So when I run my comparison the
> values is always equal even though I read a new value from the
> recordset. Please help.
>
>


You've got a bunch of lines commented out, so I can't tell what you expect to
run and what you may have forgotten you commented out.

Trim this down to what actually executes, then re-post. You may find that you
accidentally commented out something you meant to run.

--
--
~kaeli~
When you choke a smurf, what color does it turn?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Most popular values in a recordset Eddie ASP General 2 12-13-2005 10:58 AM
Problem filtering recordset by values held in array Tim Pollard ASP General 8 12-03-2004 02:57 PM
Response.write RecordSet values Fawke101 ASP General 4 04-21-2004 04:38 PM
RecordSet.Move or RecordSet.AbsolutePosition?? Hung Huynh ASP General 8 09-24-2003 11:07 AM
Inserting text box into a form, displaying values from recordset Bill ASP General 2 07-09-2003 07:46 PM



Advertisments