ADOX创建Access用户和组
// BeginGroupCpp.cpp
// compile with: /EHsc
#import "msadox.dll" no_namespace
#include "iostream"
using namespace std;
inline void TESTHR(HRESULT x) {if FAILED(x) _com_issue_error(x);};
int main() {
if (FAILED(::CoInitialize(NULL)) )
return -1;
HRESULT hr = S_OK;
// Define and initialize ADOX object pointers. These are in ADODB namespace.
_CatalogPtr m_pCatalog = NULL;
_UserPtr m_pUserNew = NULL;
_UserPtr m_pUser = NULL;
_GroupPtr m_pGroup = NULL;
// Define String Variables.
_bstr_t strCnn("Provider=Microsoft.Jet.OLEDB.4.0;User ID=myUsername;Data Source=C:\mydatabase.mdb;Jet OLEDB:Password=myPassword;Jet OLEDB:System Database=system.mdw;");
try {
TESTHR(hr = m_pCatalog.CreateInstance(__uuidof (Catalog)));
m_pCatalog->PutActiveConnection(strCnn);
// Create and append new group with a string.
m_pCatalog->Groups->Append("Accounting");
// Create and append new user with an object.
TESTHR(hr = m_pUserNew.CreateInstance(__uuidof(User)));
m_pUserNew->PutName("Pat Smith");
m_pUserNew->ChangePassword("", "Password1");
m_pCatalog->Users->Append(_variant_t((IDispatch *)m_pUserNew), "");
// Make the user Pat Smith a member of the Accounting group by creating and adding the
// appropriate Group object to the user's Groups collection. The same is accomplished if a User
// object representing Pat Smith is created and appended to the Accounting group Users collection
m_pUserNew-
相关文档:
项目中用到了此功能。把大概做法跟大家共享下,希望对大家有所帮助。也给自己总结一下,激励自己再接再厉。下面中部分代码被汉字替换了,主要考虑到公司的产品权,希望谅解。
/// <summary>
  ......
今天,还是在做那个项目,依然使用往常的sqlhelper用法,往常的数据库操作类,但是偏偏调试不成功,而且最重要的是,它不报错
中午吃饭回来,本来想打算睡个午觉的,但是项目太紧迫了,于是又跟车车研究了一中午,最后,发现如果不用@参数传递的话,是正常运行的,于是百度了一下,那些人说要用“?”当占位符
......
<?php
$connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("data.mdb");
$connid=odbc_connect($connstr,"","",SQL_CUR_USE_ODBC);
$issuetime=date("Y-m-d H:i:s");
$sql="insert into test values("","",...)";
$result=odbc_exec($connid,$sql);
if($result) echo "successful";
else ec ......
<%Dim connstrconnstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Stu.mdb")
Set bb = Server.CreateObject("ADODB.Connection")
bb.Open connstr%>
<html>
<head>
<meta http-equiv="content-Language" content="zh-cn" />
<meta http-equiv="Content-Type ......
熟悉SQL SERVER 2000的数据库管理员都知道,其DTS可以进行数据的导入导出,其实,我们也可以使用Transact-SQL语句进行导入导出操作。在 Transact-SQL语句中,我们主要使用OpenDataSource函数、OPENROWSET 函数,关于函数的详细说明,请参考SQL联机帮助。利用下述方法,可以十分容易地实现SQL SERV ......