使用DAO3.6 访问Access
大家好。我是新手,刚开始学习C++ builder,有一个问题请教大家,麻烦指点一下,小弟先谢谢了。
有一个Access的数据库,表table1,表里有两列name,password.
请问我如何能读取出表中的值呢?
我尝试写的程序如下,
Variant theDAO;
Variant theDB;
Variant theTable;
theDAO=Variant::CreateObject("DAO.DBEngine.36");
theDB=theDAO.Exec(Function("OpenDatabase") << "d:1.MDB");
theTable=theDB.Exec(Function("OpenRecordSet") << "table1");
while(bool(theTable.Exec(PropertyGet("EOF")))==false)
{
...
theTable.Exec(Procedure("MoveNext"));
}
theTable.Exec(Procedure("Close"));
就是循环里如何写,能读出来每条记录中每个列的值呢?