Welcome back, -dt-. You last visited: Today, 04:56 AM
Private Messages: New 0, Unread 0, Total 23.
View Latest Posts

Messenger Plus! Live Forums » Messenger Plus! Live Extension » Scripts » DATABASE?

Reply 
DATABASE?
Author: Message:
Ruwen
Junior Member



Posts: 18
Joined: Jul 2006
Status: Offline
DATABASE?

Is there not a database or something.. and how do i call things from it.. and save in it?

Even, how do i change something in it.. if i /mpm <password>
then it put/change <password> in the database..

IP Address: Logged

07-09-2006 06:50 AM
Profile E-Mail PM Find Quote Quick Quote Report
segosa
Community's Choice
Beta Tester



Posts: 1151
Reputation: 80
Age: 18, Sex:
Joined: Feb 2003
Status: Offline
RE: DATABASE?

what?

IP Address: Logged

07-09-2006 06:54 AM
Profile PM Web Find Quote Quick Quote Report
Ruwen
Junior Member



Posts: 18
Joined: Jul 2006
Status: Offline
RE: DATABASE?

If i use a function call.. milkedtoday

lets say i want it to be 0 in the database.. how do i change it to 1.. or if it is null then add it to 1

quote:
Originally posted by Nathan
I think he means he wants to call a database for data, and a password field(maybe) to login to it.
If you see what i mean


Correct

IP Address: Logged

07-09-2006 06:58 AM
Profile E-Mail PM Find Quote Quick Quote Report
Nathan
Posting Freak



Be like that then :P

Posts: 1303
Reputation: 35
Age: 13, Sex:
Joined: Apr 2005
Status: Offline
RE: DATABASE?

I think he means he wants to call a database for data, and a password field(maybe) to login to it.
If you see what i mean

Ooops I deleted it cos i thought it was wrong (Smilie) (reposted (Smilie))

IP Address: Logged

07-09-2006 07:00 AM
Profile E-Mail PM Find Quote Quick Quote Report
Griffo
Junior Member



Posts: 23
Joined: Apr 2006
Status: Offline
RE: DATABASE?

I would appreciate some info on this to. As I currently cannot connect to my database through JScript, I have to hard code it into my DLL, which isn't what I want to do as the path to the database may change. But when I try and pass the path to the DLL for it to connect to the database, I get an error stating "object variable or with block not set". Any suggestions?

IP Address: Logged

07-17-2006 01:52 AM
Profile E-Mail PM Find Quote Quick Quote Report
cloudhunter
Full Member



Posts: 107
Reputation: 2
Joined: Dec 2005
Status: Offline
RE: DATABASE?

Would help if you posted your code...

Cloudy

IP Address: Logged

07-17-2006 11:14 AM
Profile E-Mail PM Find Quote Quick Quote Report
Griffo
Junior Member



Posts: 23
Joined: Apr 2006
Status: Offline
RE: DATABASE?

Well I am using a DLL to do it, but here you go...

SCRIPT:
code:
var Shell = new ActiveXObject("WScript.Shell");
var MyActiveXObject = new ActiveXObject('RSP2MusicDLL.clsRSP2Music');
Shell.RegRead(MsgPlus.ScriptRegPath + "RSPpath");
var path = Shell.RegRead(MsgPlus.ScriptRegPath + "RSPpath");
var start = Shell.RegRead(MsgPlus.ScriptRegPath + "RSPenable");

if(start == -1)
{
MyActiveXObject.SetPath(path);
MsgPlus.AddTimer("RefreshTimer", 2000);
}


DLL:
Global Vars:
code:
Dim DB As Database
Dim RS As Recordset


Load Precedure:
code:
Public Sub SetPath(strPath As String)
'Setup database settings
Set DB = OpenDatabase(strPath)
Set RS = DB.OpenRecordset("SELECT * FROM OnAir ORDER BY FullName ", dbOpenDynaset)
End Sub


The line that it errors on is in the timer, which is...
code:
var RSPArtist = MyActiveXObject.GetRSPArtist();

IP Address: Logged

07-17-2006 07:13 PM
Profile E-Mail PM Find Quote Quick Quote Report
-dt-
Posting Freak
Beta Tester



$dt->capture($shawnz);

Posts: 1199
Reputation: 58
Age: 17, Sex:
Joined: Mar 2004
Status: Online
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 08:35 PM by -dt-.

IP Address: Logged

07-17-2006 08:33 PM
Profile PM Web Find Del Edit Quote Quick Quote Report
RaceProUK
Posting Freak
Beta Tester



Phoenix is going Live

Posts: 4999
Reputation: 52
Age: 21, Sex:
Joined: Oct 2003
Status: Offline
RE: DATABASE?

quote:
Originally posted by -dt-
so why not use COM to open it in jscript

The other possibility is ADO, which can be used directly in JScript, and is compatible with more database types than just Access.

This post was edited on 07-17-2006 at 09:47 PM by RaceProUK.

Phoenix 2 - More control over Messenger
RPSoftware - Appassionato ne MSN Messenger

IP Address: Logged

07-17-2006 09:47 PM
Profile PM Web Find Quote Quick Quote Report
-dt-
Posting Freak
Beta Tester



$dt->capture($shawnz);

Posts: 1199
Reputation: 58
Age: 17, Sex:
Joined: Mar 2004
Status: Online
RE: DATABASE?

quote:
Originally posted by RaceProUK
quote:
Originally posted by -dt-
so why not use COM to open it in jscript
The other possibility is ADO, which can be used directly in JScript, and is compatible with more database types than just Access.

(Smilie) i used ADO

IP Address: Logged

07-17-2006 09:52 PM
Profile PM Web Find Del Edit Quote Quick Quote Report
John Anderton
Posting Freak
Beta Tester



dt is nwwb

Posts: 2687
Reputation: 63
Age: 19, Sex:
Joined: Nov 2004
Status: Offline
RE: DATABASE?

quote:
Originally posted by RaceProUK
quote:
Originally posted by -dt-
so why not use COM to open it in jscript
The other possibility is ADO, which can be used directly in JScript, and is compatible with more database types than just Access.

I think it was a rhetorical question (Smilie)

IP Address: Logged

07-17-2006 09:54 PM
Profile E-Mail PM Web Find Quote Quick Quote Report
RaceProUK
Posting Freak
Beta Tester



Phoenix is going Live

Posts: 4999
Reputation: 52
Age: 21, Sex:
Joined: Oct 2003
Status: Offline
RE: DATABASE?

quote:
Originally posted by -dt-
i used ADO
quote:
Originally posted by -dt-
ADODB.Connection'
Hmm... so you did...
* RaceProUK is blind
Phoenix 2 - More control over Messenger
RPSoftware - Appassionato ne MSN Messenger

IP Address: Logged

07-17-2006 10:03 PM
Profile PM Web Find Quote Quick Quote Report
Griffo
Junior Member



Posts: 23
Joined: Apr 2006
Status: Offline
RE: DATABASE?

Thanks guys!

Any ideas why the Debug line gives me Type Mismatch?

code:
function OnEvent_Initialize(MessengerStart)
{
var db = new ActiveXObject('ADODB.Connection');
var dbPath = "C:\\DB\\DB.mdb";
db.Open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" + dbPath +";DefaultDir=;UID=;PWD=;");

var results = db.Execute("SELECT * FROM OnAir ORDER BY FullName");
Debug.Trace(results);
}

IP Address: Logged

07-18-2006 06:02 AM
Profile E-Mail PM Find Quote Quick Quote Report
RaceProUK
Posting Freak
Beta Tester



Phoenix is going Live

Posts: 4999
Reputation: 52
Age: 21, Sex:
Joined: Oct 2003
Status: Offline
RE: DATABASE?

'results' is a Recordset, which isn't easily convertable to a string.
code:
while (!results.EOF) {
    Debug.Trace(results.GetString());
    results.MoveNext();
}
should print off all records.
Phoenix 2 - More control over Messenger
RPSoftware - Appassionato ne MSN Messenger

IP Address: Logged

07-18-2006 06:19 AM
Profile PM Web Find Quote Quick Quote Report
Griffo
Junior Member



Posts: 23
Joined: Apr 2006
Status: Offline
RE: DATABASE?

Thanks, works great! (Smilie)

IP Address: Logged

07-18-2006 06:38 AM
Profile E-Mail PM Find Quote Quick Quote Report
Griffo
Junior Member



Posts: 23
Joined: Apr 2006
Status: Offline
RE: DATABASE?

Hey guys,

DB stuff workign great now. However, I notice on one of the strings I am pulling, it sticks like a small square at the end of it which then appears on my MSN PSM. Any idea what the little square represents and how I can remove or trim it?

Thanks (Smilie)

IP Address: Logged

Yesterday 12:52 AM
Profile E-Mail PM Find Quote Quick Quote Report
cloudhunter
Full Member



Posts: 107
Reputation: 2
Joined: Dec 2005
Status: Offline
RE: DATABASE?

Perhaps the small square could be a line break? Or an "end of field"? To find out what the little square is, output it to the debug console using debug.trace. Then you can use regexp to strip it out.

Cloudy

IP Address: Logged

Yesterday 01:04 AM
Profile E-Mail PM Find Quote Quick Quote Report
RaceProUK
Posting Freak
Beta Tester



Phoenix is going Live

Posts: 4999
Reputation: 52
Age: 21, Sex:
Joined: Oct 2003
Status: Offline
RE: DATABASE?

Can you print out the small square as an integer? Then it can be cross-referenced with an ASCII or Unicode chart to see what it's meant to be.

This post was edited Yesterday at 01:07 AM by RaceProUK.

Phoenix 2 - More control over Messenger
RPSoftware - Appassionato ne MSN Messenger

IP Address: Logged

Yesterday 01:07 AM
Profile PM Web Find Quote Quick Quote Report
Griffo
Junior Member



Posts: 23
Joined: Apr 2006
Status: Offline
RE: RE: DATABASE?

quote:
Originally posted by cloudhunter
Perhaps the small square could be a line break? Or an "end of field"? To find out what the little square is, output it to the debug console using debug.trace. Then you can use regexp to strip it out.

Cloudy



Yea I think you are right there, here is the debug below. How would I remove the break?

Thanks (Smilie)

CODE:
code:
Debug.Trace(Artist + "-" + Title);


DEBUG::
code:
Function called: OnEvent_Timer
BBE -
-Flash


IP Address: Logged

Yesterday 07:14 AM
Profile E-Mail PM Find Quote Quick Quote Report
« Next Oldest Return to Top Next Newest »
New Thread  Reply 
Quick Reply [rules] [smilies]
Message:
Type your reply to this thread here.

 Signature
 Email Notification
 Disable Smilies


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 can post new threads
You can post replies
You can post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On