Access Plugins

Viktoras Didziulis viktoras at ekoinf.net
Wed Dec 6 05:11:34 EST 2006


try communicating with Access driver through js or vbs script. In both js
and vbs there is a way to build a dsn-less connections to nearly any type of
relational database. A while ago I worked with this from within hta apps,
but now went multiplatform with Rev and start forgetting those things... For
example this jscript function creates and uses dsn-less connection to
execute SQL commands: 
 
function dbAccess(sql) 
{ 
var dbrcd, cString, sql; 
 
// Creating ADO Recordset 
dbrcd = new ActiveXObject( "ADODB.Recordset" ); 
 
//Creating the connection string 
cString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=Tables.mdb"; 
 
// Create SQL Statement 
//sql = "SELECT * from table1"; 
 
// Open connection to database 
dbrcd.Open( sql, cString, 1, 3); 
 
while( !dbrcd.EOF ) 
{ 
// Loop through each field in this record 
// and add contents to variable 
for( i = 0; i < dbrcd.Fields.Count; i++ ) 
{ record+= dbrcd(i) + " ";} 
 
//Move to the next record and loop 
dbrcd.MoveNext(); 
record+="\n"; 
} 
 
return (record); 
} 
 
Although I have never tried creating new database or defining schema with
this, but maybe it can be useful in this regard too...  Rev studio has open
driver close driver handlers, although I have never tried to communicate
with Access driver directly from within Rev, could this work ?..
 
Best regards 
Viktoras 
 



More information about the use-livecode mailing list