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-
相关文档:
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
{
......
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
{
......
1.连接Access的连接字符串
string strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @FileName;
2.连接Excel
string strExcel = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + @FileName + ";Extended Properties=Excel 8.0;"; ......
asp 中文乱码,asp access 乱码,asp 刷新后乱码,asp utf 8乱码,ajax 乱码 asp,asp 汉字乱码,asp乱码怎么办
用utf-8编码用在新的网站上,不想问题还真多,所以找了些文章,帖子,看了看,等下有用的就贴下面了。
今天,我开始把 CODEPAGE="936" 改成 CODEPAGE="65001"
把charset=gb2312改成 charset=utf-8
可是还是乱码 ......