sqLite:
QSqlDatabase db;
db = db.addDatabase("QSQLITE");
db.setDatabaseName("test.db"); // 默认在当前程序目录下面创建此db
db.open();
access:
其实就是用ado方式去做
#import "C:\Program Files\Common Files\System\ado\msado15.dll" rename("EOF", "adoEOF")
#import "C:\Program Files\Common Files\system\ado\msadox.dll"
using namespace ADODB;
QFile path("d:\\test.mdb");
if (!path.exists())
{
_bstr_t s("Provider=Microsoft.JET.OLEDB.4.0;Data source= d:\\test.mdb; User ID = admin;Jet OLEDB:Database Password = admin");
ADOX::_CatalogPtr pCatalog = NULL;
pCatalog.CreateInstance(__uuidof (ADOX::Catalog));
pCatalog->Create(s);
}
欢迎留言或者发邮件一起探讨:2801673893@qq.com