What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » DATABASE?

DATABASE?
Author: Message:
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: DATABASE?
it seems you're using a microsoft access database... so why not use COM to open it in jscript

an example of opening , fetching some data and closing the database
code:
var db = new ActiveXObject('ADODB.Connection');
var dbPath = "C:\\Program Files\\Messenger Plus! Live\\Scripts\\test\\db1.mdb";
db.open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" + dbPath +";DefaultDir=;UID=;PWD=;");

var results = db.Execute("SELECT * FROM xxx");

var xxx = resultsToArray(results);

for(var i=0;i<xxx.length;i++){
    Debug.Trace("Row: " + i);
    for(x in xxx[i]){
        Debug.Trace(x + " : " + xxx[i][x]);
    }
}

db.close();


function resultsToArray(result){
    var res = new Array();
    while(!result.EOF){
        var row = {};
        for(var enume = new Enumerator(result.Fields);!enume.atEnd();enume.moveNext()){
            row[enume.item().name] = enume.item().value;
        }
        res.push(row);
        result.MoveNext();
    }
    return res;
}


This post was edited on 07-17-2006 at 11:05 AM by -dt-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
07-17-2006 11:03 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
DATABASE? - by Ruwen on 07-08-2006 at 09:20 PM
RE: DATABASE? - by segosa on 07-08-2006 at 09:24 PM
RE: DATABASE? - by Ruwen on 07-08-2006 at 09:28 PM
RE: DATABASE? - by Nathan on 07-08-2006 at 09:30 PM
RE: DATABASE? - by Griffo on 07-16-2006 at 04:22 PM
RE: DATABASE? - by cloudhunter on 07-17-2006 at 01:44 AM
RE: DATABASE? - by Griffo on 07-17-2006 at 09:43 AM
RE: DATABASE? - by -dt- on 07-17-2006 at 11:03 AM
RE: DATABASE? - by RaceProUK on 07-17-2006 at 12:17 PM
RE: DATABASE? - by -dt- on 07-17-2006 at 12:22 PM
RE: DATABASE? - by John Anderton on 07-17-2006 at 12:24 PM
RE: DATABASE? - by RaceProUK on 07-17-2006 at 12:33 PM
RE: DATABASE? - by Griffo on 07-17-2006 at 08:32 PM
RE: DATABASE? - by RaceProUK on 07-17-2006 at 08:49 PM
RE: DATABASE? - by Griffo on 07-17-2006 at 09:08 PM
RE: DATABASE? - by Griffo on 07-19-2006 at 03:22 PM
RE: DATABASE? - by cloudhunter on 07-19-2006 at 03:34 PM
RE: RE: DATABASE? - by Griffo on 07-19-2006 at 09:44 PM
RE: DATABASE? - by RaceProUK on 07-19-2006 at 03:37 PM
RE: DATABASE? - by Richy on 02-24-2008 at 05:30 PM
RE: DATABASE? - by MeEtc on 02-24-2008 at 06:53 PM
RE: DATABASE? - by Richy on 02-24-2008 at 07:16 PM
RE: DATABASE? - by MeEtc on 02-29-2008 at 02:50 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On