如何打开MDB数据库? (c mdb数据库路径)

新建表:首先打开或新建一个数据库,在该数据库上使用cdaotabledef的构赵函数定义一个对象,在调用create函数建新表,之后调用append函升消数加入数据库:

void changeuserpassword( )

{

cstring strsystemdb =

_t( “吵桐知路径” );

setsystemdb( strsystemdb );

// user name and password manually added

// by using microsoft access

cstring strusername = _t( “newuser” );

cstring stroldpassword = _t( “password” );

cstring strnewpassword = _t( “newpassword” );

setdefaultuser( strusername, stroldpassword );

changepassword( strusername, stroldpassword,

strnewpassword );

}

//设置默认用户和密码

void setdefaultuser(cstring & strusername, cstring & strpassword)

{

colevariant varusername( strusername, vt_bstrt );

colevariant varpassword( strpassword, vt_bstrt );

daodbengine* pdbengine = afxdaogetengine( );

assert( pdbengine != null );

// 设置默认用户

dao_check( pdbengine->put_defaultuser( varusername.bstrval ) );

// 设置默认密码

dao_check( pdbengine->put_defaultpassword( varpassword.bstrval ) );

}

///更改密码

void setdbpassword( lpctstr pdb, lpctstr pszoldpassword, lpctstr psznewpassword )

{

cdaodatabase db;

cstring strconnect( _t( “;pwd=” ) );

// 数据库必须打开

// 设轮陵置密码

db.open( pdb, true, false,

strconnect + pszoldpassword );

colevariant newpassword( psznewpassword, vt_bstrt ),

oldpassword( pszoldpassword, vt_bstrt );

dao_check( db.m_pdaodatabase->newpassword( v_bstr( &oldpassword ),

v_bstr( &newpassword ) ) );

db.close();

}


数据运维技术 » 如何打开MDB数据库? (c mdb数据库路径)