Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does the cloned RS be updated when the orginal is?

Status
Not open for further replies.

aspengal

Technical User
Dec 27, 2004
41
US
Hi folks, I have a Recordset temprs which is a clone of Recordset rs. In my function, Iam taking a clone of rs into temprs and then Iam updating rs. After updating rs, if i check my temprs, its also updated with the rs values rather than retaining the preupdated value. Why does this happen? I would like to take a clone of the original rs and then manupulate the rs in Function F1 and then in Function F2, I would like to merge the cloned recordset and the original record set. is this possible? Please help. Below is the code i used.
****
function ActualsProjection(){
var temprs1 = new ActiveXObject("AdoDb.RecordSet");
temprs1 = rs.clone();

rs.movefirst();
while(!rs.eof)
{
rs('TASKCOMPLETION_APPROVAL').value = 1;
rs.update();
rs.movenext();
}
filter = "TASKCOMPLETION_APPROVAL = 2";
temprs1.Filter = filter;
if(temprs1.Recordcount ==0)
alert('Clone has been updated by mistake. This should not happen.Clone should have retained the Orginal Recordset');

}
 
this is more of a server-side ASP jscript question - try the asp forum333

-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
i like your sleeves...they're real big
 
>I would like to take a clone of the original rs and then manupulate the rs...
To sever the sync between the rs and its clone temprs, you can do so by requerying to re-establish the rs. The clone will then stay out-of-sync and is ready for further manipulation as the orginial rs.
 
>> " Looks like an activeX client-side bit of code"
so it is... i just saw the adodb.recordset and switched to server side mode :-D

IMHO, if security is of any importance, it would be wise to move this code to server-side lest you expose your database login credentials and table structures to everyone via view-source.


-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
i like your sleeves...they're real big
 
Hi All, Thanks all for your response. Appreciate it. I figured out a way to do this. Iam not able to requery the original rs. So, I created temprs from scratch rather than cloning it. Here it is and it works!!!! Have a gr8 week end
****
temprs2 = null;
temprs2 = new ActiveXObject("ADODB.RecordSet");
temprs2.CursorLocation = 3;
temprs2.Fields.Append("TASKID", 20, -1, 0);
temprs2.Fields.Append("TASKUID", 3, -1, 0);
temprs2.Fields.Append("TASKNAME", 202, -1, 0);
temprs2.Fields.Append("TASKCOMPLETIONAPPROVAL", 3, -1, 0);
temprs2.Open();

var Fieldnames1 = new Array();
var FieldValues1 = new Array();

Fieldnames1[0] = "TASKID";
Fieldnames1[1] = "TASKUID";
Fieldnames1[2] = "TASKNAME";
Fieldnames1[3] = "TASKCOMPLETIONAPPROVAL";

rs.MoveFirst();
while( !rs.eof )
{
strtask = rs('TASK_ID').value;
FieldValues1[0] = rs('TASK_ID').value;
FieldValues1[1] = rs('TASK_UID').value;
FieldValues1[2] = rs('TASK_NAME').value;
FieldValues1[3] = rs('TASKCOMPLETION_APPROVAL').value;
temprs2.AddNew(Fieldnames1, FieldValues1);
temprs2.Update();
rs.movenext();
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top