Created
December 14, 2012 12:08
-
-
Save pewerner/4284998 to your computer and use it in GitHub Desktop.
Query MS-Access Data-base from JS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AddRecord() { | |
var adoConn = new ActiveX("ADODB.Connection"); | |
var adoRS = new ActiveX("ADODB.Recordset"); | |
adoConn.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= C:\\Users\\Pete\\Desktop\\Plate Layouts.accdb"); | |
adoRS.Open("Select * From [Plate Layouts]", adoConn, 1, 3); | |
var myData = adoRS.GetString() | |
print(myData) | |
//adoRS.AddNew; | |
//adoRS.Fields("FieldName").value = "Quentin"; | |
adoRS.Update; | |
adoRS.Close(); | |
adoConn.Close(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AddRecord() { | |
//var adoConn = new ActiveXObject("ADODB.Connection"); | |
var adoConn = new ActiveX("ADODB.Connection"); | |
//var adoRS = new ActiveXObject("ADODB.Recordset"); | |
var adoRS = new ActiveX("ADODB.Recordset"); | |
adoConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='/\dbName.mdb'"); | |
adoRS.Open("Select * From tblName", adoConn, 1, 3); | |
adoRS.AddNew; | |
adoRS.Fields("FieldName").value = "Quentin"; | |
adoRS.Update; | |
adoRS.Close(); | |
adoConn.Close(); | |
} | |
function DeleteRecord() { | |
var adoConn = new ActiveX("ADODB.Connection"); | |
var adoRS = new ActiveX("ADODB.Recordset"); | |
adoConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='\\dbName.mdb'"); | |
adoRS.Open("Select * From tblName Where FieldName = 'Quentin'", adoConn, 1, 3); | |
adoRS.Delete; | |
adoRS.Delete; | |
adoRS.Close(); | |
adoConn.Close(); | |
} | |
function EditRecord() { | |
var adoConn = new ActiveX("ADODB.Connection"); | |
var adoRS = new ActiveX("ADODB.Recordset"); | |
adoConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='\\dbName.mdb'"); | |
adoRS.Open("Select * From tblName Where FieldName = 'Quentin'", adoConn, 1, 3); | |
adoRS.Edit; | |
adoRS.Fields("FieldName").value = "New Name"; | |
adoRS.Update; | |
adoRS.Close(); | |
adoConn.Close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment