You can use the following code :
static void ConnectToAccess(Args _args)
{
//Declare connection object
CCADOConnection cn = new CCADOConnection();
CCADOCommand command = new CCADOCommand();
CCADORecordset rs = new CCADORecordset();
str Name;
;
//open connection and execute SQL command
cn.open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Sample.mdb;Persist Security Info=False");
command.activeConnection(cn);
command.commandText("SELECT * FROM DEPARTMENTS");
rs = command.execute();
while (!rs.EOF())
{
info(Strfmt("%1",rs.fields().itemIdx(1).value())); //will display query value
rs.recordSet().moveNext();
}
cn.close();
}
No comments:
Post a Comment