Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Translating JScript to VBScript
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Bandit
Starting Member

15 Posts

Posted - 12 March 2002 :  11:00:45  Show Profile
I need to translate this JScript to VBScript.
Can someone help me please ?


<script language=VBScript RunAt=Server>
function Disconnect(objRS)
set objRS.ActiveConnection = nothing
end function
</script>

<script language=JScript RunAt=Server>
function TreeCount(objRSCats, objRSLinks, intID){
var
arrSons, intLinks = 0, i;
objRSCats.Filter = 'PARENT_ID = ' + intID;
if (!objRSCats.EOF){
arrSons = new VBArray(objRSCats.GetRows(adGetRowsRest, adBookmarkFirst, 'CAT_ID')).toArray();
for (i = 0; i < arrSons.length; i++)
intLinks += TreeCount(objRSCats, objRSLinks, arrSons[i]);
}
objRSLinks.Filter = 'LINK_CAT_ID = ' + intID;
intLinks += objRSLinks.RecordCount;
if (intID > 0){
objRSCats.Filter = 'CAT_ID = ' + intID;
objRSCats.Update('LinkCount', intLinks);
}
return intLinks;
}

function Dump(objRS){
objRS.Filter = adFilterNone;
Response.Write(objRS.GetString(2, -1, ', ', '<br>', ''));
}

function Calc(){
var
strCon, strSQL, objCon, objRSCats, objRSLinks;
strCon = 'Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=E:\\SERVER\\WWWROOT\\tdnod\\db\\test.mdb';
objCon = Server.CreateObject('ADODB.Connection');
objCon.Open(strCon);
strSQL = 'SELECT CAT_ID, CAT_NAME, PARENT_ID, CAT_ID AS LinkCount FROM CATS';
objRSCats = Server.CreateObject('ADODB.Recordset');
objRSCats.CursorType = adUseClient;
objRSCats.CursorLocation = adOpenStatic;
objRSCats.LockType = adLockOptimistic;
objRSCats.Open(strSQL, objCon);
objRSCats(0).Properties('Optimize') = true;
objRSCats(2).Properties('Optimize') = true;
Disconnect(objRSCats);
strSQL = 'SELECT LINK_ID, LINK_NAME, LINK_CAT_ID FROM LINKS';
objRSLinks = Server.CreateObject('ADODB.Recordset');
objRSLinks.CursorType = adUseClient;
objRSLinks.CursorLocation = adOpenStatic;
objRSLinks.LockType = adLockReadOnly;
objRSLinks.Open(strSQL, objCon);
objRSLinks(2).Properties('Optimize') = true;
Disconnect(objRSLinks);
TreeCount(objRSCats, objRSLinks, 0);
Dump(objRSCats);
objRSCats.Close();
objRSLinks.Close();
objCon.Close();
}
</script>
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07