if can, how to? thanks.
Can I access SQL database in MUSHclient with Jscript?
Posted by Lbc on Sat 04 Aug 2001 12:14 PM — 8 posts, 36,605 views.
Another interesting challenge. :)
I had wondered this myself, and your question prompted me to find the answer. I got the following code to work - whether it works for you depends on whether you have the same things installed, but let's hope. In any case it is a guide to the technique.
I tested this in the immediate window, but in practice you would put it inside a suitable function.
My example assumes:
I had wondered this myself, and your question prompted me to find the answer. I got the following code to work - whether it works for you depends on whether you have the same things installed, but let's hope. In any case it is a guide to the technique.
I tested this in the immediate window, but in practice you would put it inside a suitable function.
My example assumes:
- Database is set up as an ODBC database (I used MySQL on Windows NT) - with the DSN set up as a system dsn called "database_dsn"
- My user id is "myname" and the password is "swordfish"
- I am doing a select on table "mytable"
- I am extracting "fieldname" (ie. a field in the table) and using world.note to display it on the screen
// make our COM object
var rsl = new ActiveXObject("ADODB.Recordset.2.5");
// the select statement we want to execute
var source = "SELECT * from mytable LIMIT 10";
// the connect string
var connect = "DSN=database_dsn;" +
"User Id=myname;" +
"Password=swordfish;"
// open the database, do the select
rsl.Open (source, connect, 0);
// loop until end of file (EOF)
while (!rsl.EOF )
{
world.note (rsl ("fieldname"));
rsl.MoveNext ();
}
// close database
rsl.Close;
// release the COM object
rsl = "";
Thanks a lot
i have almost done it myself before u replied my post:P
it took me a whole day to find article in Microsoft's web
site:(
here's my code, i made a bad mistake, after i saw ur post,
i solved it, this code is a bit different with urs:)
//////////////////////////////////////////////
function test1()
{
var xxx=new ActiveXObject("ADODB.Connection");
var rs = new ActiveXObject("ADODB.RecordSet");
xxx.Open("DSN=test1");
rs=xxx.Execute("select * from list1")
//while (!rs.EOF)
//world.note(rs.exits); THIS IS MY BAD CODE,BECAUSE I DIDNT KNOW THE RIGHT WAY TO USE "ADODB.RecordSet"
while (!rs.EOF)
world.note(rs("exits"));//this is right after i saw ur post:)
rs.close();
rs = nothing;
}
BTW:could u please give out a handbook of ADO?or tell me where can i get it, i cant find it in M$'s homepage, thanks again:)
i have almost done it myself before u replied my post:P
it took me a whole day to find article in Microsoft's web
site:(
here's my code, i made a bad mistake, after i saw ur post,
i solved it, this code is a bit different with urs:)
//////////////////////////////////////////////
function test1()
{
var xxx=new ActiveXObject("ADODB.Connection");
var rs = new ActiveXObject("ADODB.RecordSet");
xxx.Open("DSN=test1");
rs=xxx.Execute("select * from list1")
//while (!rs.EOF)
//world.note(rs.exits); THIS IS MY BAD CODE,BECAUSE I DIDNT KNOW THE RIGHT WAY TO USE "ADODB.RecordSet"
while (!rs.EOF)
world.note(rs("exits"));//this is right after i saw ur post:)
rs.close();
rs = nothing;
}
BTW:could u please give out a handbook of ADO?or tell me where can i get it, i cant find it in M$'s homepage, thanks again:)
Your method is probably better, because you separate out getting the connection from getting the recordset, thus you can get multiple recordsets in one script.
You could also use "ADODB.Command" to send commands to SQL - eg. "create table", "update table", and so on.
As for finding more details, I went to Microsoft's site, clicked on "Search", typed in "ado" and checked only "Developer resources" and "Support & the knowledge base" and found quite a good example as the first search result (in VB, but you can get the drift from it).
You could also use "ADODB.Command" to send commands to SQL - eg. "create table", "update table", and so on.
As for finding more details, I went to Microsoft's site, clicked on "Search", typed in "ado" and checked only "Developer resources" and "Support & the knowledge base" and found quite a good example as the first search result (in VB, but you can get the drift from it).
thank u very much
i found a microsoft ado programmer book, it's very nice.
eh, another question: how can i pay shareware fee in cash,
if i have not a credit card?
i found a microsoft ado programmer book, it's very nice.
eh, another question: how can i pay shareware fee in cash,
if i have not a credit card?
Yes, you can pay with cash by using our Secure Online Server
I used the same method to access the MS Access database. The only problem is that I can not make it support international language. Every non-English characters I retrieved back is ?.
Any idea how can I solve the problem?
Thanks
Any idea how can I solve the problem?
Thanks
I don't know. A quick scan of the knowledge base has revealed hundreds of articles that match on "Access" and "unicode", and I don't have time to read them all.
Try looking/asking around on some of the developer forums (eg. CodeProject, CodeGuru), as your question is not really specific to MUSHclient.
Try looking/asking around on some of the developer forums (eg. CodeProject, CodeGuru), as your question is not really specific to MUSHclient.