Whilst doing my computing project for college, i wrote a javascript version of a VB script that allowed you to connect to a database run and return query results.

Well here it is, the odds are i will develop it some more as my project goes along

function query(){	//the function that connects and queries the database.

    //open the DB
    dbc = new ActiveXObject("ADODB.Connection");
    dbc.Provider = "Microsoft.Jet.OLEDB.4.0";
    dbc.ConnectionString = "Data Source=data.mdb";
dbc.Open	//open the database connection with the above settings
    //create a recordset from an SQL query
    rs = new ActiveXObject("ADODB.Recordset");

    rs.ActiveConnection = dbc;
    rs.CursorLocation = 3; 			//adUseClient
    rs.LockType = 3; 				//adLockOptimistic
    rs.Open ("Select * FROM TBLSTUFF");				//open the sql query

rs.fieldname is the field you want to retrieve from the record, it supports returnning multiple fields.

I have got more got but it isn't aswell documented as this, when i document it which i have todo i will post some more of it.

NOTE: if you do insert into statement it automatically closes a recordset so you don't need to close the record set.