DATABASE? - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: DATABASE? (/showthread.php?tid=62845)
DATABASE? by Ruwen on 07-08-2006 at 09:20 PM
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..
RE: DATABASE? by segosa on 07-08-2006 at 09:24 PM
what?
RE: DATABASE? by Ruwen on 07-08-2006 at 09:28 PM
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
RE: DATABASE? by Nathan on 07-08-2006 at 09:30 PM
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 (reposted )
RE: DATABASE? by Griffo on 07-16-2006 at 04:22 PM
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?
RE: DATABASE? by cloudhunter on 07-17-2006 at 01:44 AM
Would help if you posted your code...
Cloudy
RE: DATABASE? by Griffo on 07-17-2006 at 09:43 AM
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();
RE: DATABASE? by -dt- on 07-17-2006 at 11:03 AM
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;
}
RE: DATABASE? by RaceProUK on 07-17-2006 at 12:17 PM
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.
RE: DATABASE? by -dt- on 07-17-2006 at 12:22 PM
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 used ADO
RE: DATABASE? by John Anderton on 07-17-2006 at 12:24 PM
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
RE: DATABASE? by RaceProUK on 07-17-2006 at 12:33 PM
quote: Originally posted by -dt-
i used ADO
quote: Originally posted by -dt-
ADODB.Connection'
Hmm... so you did...
* RaceProUK is blind
RE: DATABASE? by Griffo on 07-17-2006 at 08:32 PM
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);
}
RE: DATABASE? by RaceProUK on 07-17-2006 at 08:49 PM
'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.
RE: DATABASE? by Griffo on 07-17-2006 at 09:08 PM
Thanks, works great!
RE: DATABASE? by Griffo on 07-19-2006 at 03:22 PM
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
RE: DATABASE? by cloudhunter on 07-19-2006 at 03:34 PM
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
RE: DATABASE? by RaceProUK on 07-19-2006 at 03:37 PM
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.
RE: RE: DATABASE? by Griffo on 07-19-2006 at 09:44 PM
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
CODE:
code: Debug.Trace(Artist + "-" + Title);
DEBUG::
code: Function called: OnEvent_Timer
BBE -
-Flash
RE: DATABASE? by Richy on 02-24-2008 at 05:30 PM
Is there a solution to connect to a MySQL server through Jscript? Thank you...
RE: DATABASE? by MeEtc on 02-24-2008 at 06:53 PM
I'm not sure about a direct connection to a server, and I doubt that most webservers will allow connections from random computers. I would recommend using a php page to interface the two.
In the script that I'm developing I send data from the script in the form of HTTP POST information, which can be read by the PHP file. PHP then can connect to MySQL. For more information on this, I'd recommend you read up on this at http://volv.net/?p=13
RE: DATABASE? by Richy on 02-24-2008 at 07:16 PM
I liked HTTP POST method. However, I also need to send specific data to the user back from MySQL server. What can we do?
RE: DATABASE? by MeEtc on 02-29-2008 at 02:50 PM
Send data back to the script using return text on the PHP file.
Personally, what I do is base64_encode data fields that are separated by semi-colons, and a new line to separate data for different fields. Maybe this will give you a better description of what I mean.
|