473,471 Members | 4,629 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Value in recordset changes 2 variables Help

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;
}
Jul 23 '05 #1
1 1255
Lee
ferky said:

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.


Within all of the code you posted, the only value ever assigned
to strNewTkinit is "", so it seems like you haven't shown us the
important code.

However, your symptom sounds like strNewTkinit is being set to the
reference to an Object. In that case, setting strOldTkinit will
set that variable to refer to the *same Object*, so changing the
attributes of either one is seen in both. What to do to fix that
depends on what sort of Object is involved.

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: tornado | last post by:
Hi all, I am pretty new to PHP. I was reading PHP manual and trying out the example from 2nd chapter (A simple Tutorial). When i try to print the variable as given in the example it returns...
20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
1
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware ...
4
by: Jack | last post by:
Hi, I have a checkbox the value which goes to a database via a asp page that builds the sql string. In the front end asp page, the checkbox code is written as follows: <i><input...
27
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
6
by: Dave Hopper | last post by:
Hi I am using the following SQL to retrieve a value in a list box using a unique ID held in the list box call cntID. The list box is used on an order form to list appointments that have been...
36
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
20
by: teddysnips | last post by:
Weird. I have taken over responsibility for a legacy application, Access 2k3, split FE/BE. The client has reported a problem and I'm investigating. I didn't write the application. The...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.