易截截图软件、单文件、免安装、纯绿色、仅160KB

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-


相关文档:

SQL Access创建表

一、创建一张空表:
Sql="Create TABLE [表名]"
二、创建一张有字段的表:
Sql="Create TABLE [表名]([字段名1] MEMO NOT NULL, [字段名2] MEMO, [字段名3] COUNTER NOT NULL, [字段名4] DATETIME, [字段名5] TEXT(200), [字段名6] TEXT(200))
字段类型:
2 : "SmallInt", // 整型
3 : "Int", ......

利用 DataGridView 绘制图片列表(从Access读取图片)

using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using Microsoft.Win32;
using Access = Microsoft.Office.Interop.Access;
namespace ImageAccess
{
    static class Program
    {
   ......

php 连接access的代码

<?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 ......

VC++的ADO连接Access步骤

1:在StaAfx.h 中添加如下代码 #import "C:\\Program Files\\Common Files \\System\\ado\\msado15.dll" no_namespace rename("EOF","adoEOF")rename("BOF","adoBOF")
2:在BOOL CXXXApp::InitInstance()中初始化COM环境
   ::CoInitialize(NULL);
   释放COM环境
   ::CoUninitialize(); ......

备份和还原SQL Server及压缩Access数据库

*
 * 功能说明:备份和恢复SQL Server数据库
 * 作者: 刘功勋;
 * 版本:V0.1(C#2.0);时间:2007-1-1
 * 当使用SQL Server时,请引用 COM组件中的,SQLDMO.dll组件
 * 当使用Access中,请浏览添加引用以下两个dll
 *          引用C:/Progra ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号