朋友:
   据我所知,在创建是不能制定密码;
    在vc ado 中可以加密;
    sql的语句写在属性页上,
再说详细点

解决方案 »

  1.   

    to vcvcnet:非常感谢,具体怎么操作?如何在vc ado 中加密?最好有一小段代码。
    sql 语句在属性页上,我怎么找不到?是table右键菜单上的属性吗?
      

  2.   

    创建数据库我也不知道,哪维大哥知道的请告诉一声。
    加密数据库可以通过压缩实现,但前提是数据库已经创建了。详细情况可以看看MSJRO.CHM (在你的机子上搜索一下,一般会有的)
      

  3.   

    The following code shows how to create a new Microsoft Jet database with the Create method.// BeginCreateDatabaseCpp
    #import "c:\Program Files\Common Files\system\ado\msadox.dll" no_namespace
    #import "c:\Program Files\Common Files\system\ado\msado15.dll"#define TESTHR(x) if FAILED(x) _com_issue_error(x);#include "iostream.h"
    #include "stdio.h"
    #include "conio.h"//Function declarations
    void CreateDatabaseX(void);//------------------------------------------------------------                                       //
    //Main Function                           
    //Purpose:  Test Driver
    //------------------------------------------------------------                                       //
    void main()
    {
       HRESULT hr = S_OK;   hr = ::CoInitialize(NULL);
       if(SUCCEEDED(hr))
       {
          CreateDatabaseX();      //Wait here for the user to see the output
          printf("Press any key to continue...");
          getch();
          
          ::CoUninitialize();
       }
    }//------------------------------------------------------------                                       //
    //CreateDatabaseX                        
    //Purpose:  create a new Jet database with the Create method
    //------------------------------------------------------------                                       //
    void CreateDatabaseX()
    {   
       HRESULT hr = S_OK;   // Define ADOX object pointers.
        // Initialize pointers on define.
        // These are in the ADOX::  namespace.
       
       _CatalogPtr m_pCatalog = NULL;   
       //Set ActiveConnection of Catalog to this string
       _bstr_t strcnn("Provider=Microsoft.JET.OLEDB.4.0;"
                "Data source = c:\\new.mdb");
       try
       {
          TESTHR(hr = m_pCatalog.CreateInstance(__uuidof (Catalog)));
          m_pCatalog->Create(strcnn);   }      catch(_com_error &e)
       {
          // Notify the user of errors if any.
          _bstr_t bstrSource(e.Source());
          _bstr_t bstrDescription(e.Description());
            
          printf("\n\tSource :  %s \n\tdescription : %s \n ",(LPCSTR)bstrSource,(LPCSTR)bstrDescription);   }   catch(...)
       {
          cout << "Error occured in include files...."<< endl;
       }}
    // EndCreateDatabaseCpp
      

  4.   

    ADOX 2.7  Groups and Users Append, ChangePassword Methods Example (VC++)
    This example demonstrates the Append method of Groups, as well as the Append method of Users by adding a new Group and a new User to the system. The new Group is appended to the Groups collection of the new User. Consequently, the new User is added to the Group. Also, the ChangePassword method is used to specify the User password.// BeginGroupCpp
    #import "c:\Program Files\Common Files\system\ado\msadox.dll" no_namespace#include "iostream.h"
    #include "stdio.h"
    #include "conio.h"//Function declarations
    void GroupX(void);
    inline void TESTHR(HRESULT x) {if FAILED(x) _com_issue_error(x);};//////////////////////////////////////////////////////////
    //                                                      //
    //      Main Function                                   //
    //                                                      //
    //////////////////////////////////////////////////////////
    void main()
    {
        if(FAILED(::CoInitialize(NULL)))
            return;     GroupX();    ::CoUninitialize();
    }//////////////////////////////////////////////////////////
    //                                                      //
    //         GroupX Function                              //
    //                                                      //
    //////////////////////////////////////////////////////////
    void GroupX(void)
    {
        HRESULT hr = S_OK;    // Define ADOX object pointers.
        // Initialize pointers on define.
        // These are in the ADOX::  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;"
            "Data source = c:\\Program Files\\Microsoft Office\\"
            "Office\\Samples\\Northwind.mdb;"
            "jet oledb:system database=c:\\WINNT\\system32\\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->Groups->Append("Accounting");        // Enumerate all User objects in the 
            // catalog's Users collection.
            long lUsrIndex;
            long lGrpIndex;
            _variant_t vIndex;
            for(lUsrIndex=0;lUsrIndex<=m_pCatalog->Users->Count;lUsrIndex++)
            {
                vIndex = lUsrIndex;
                m_pUser = m_pCatalog->Users->GetItem(vIndex);
                cout<<"  "<<m_pUser->Name <<endl;
                cout<<"   Belongs to these groups:"<<endl;            // Enumerate all Group objects in each User
                // object's Groups collection.
                if(m_pUser->Groups->Count != 0)
                {
                    for(lGrpIndex=0;lGrpIndex<=m_pUser->Groups->
                        Count;lGrpIndex++)
                    {
                        vIndex = lGrpIndex;
                        m_pGroup = m_pUser->Groups->GetItem(vIndex);
                        cout<<"     "<< m_pGroup->Name<<endl;
                    }
                }
                else
                {
                    cout<<"       [None]"<<endl;
                }
            }        // Enumerate all Group objects in the default 
            // workspace's Groups collection.
            for(lGrpIndex=0;lGrpIndex<=m_pCatalog->Groups->Count;lGrpIndex++)
            {
                vIndex = lGrpIndex;
                m_pGroup = m_pCatalog->Groups->GetItem(vIndex);
                cout<<"   "<< m_pGroup->Name <<endl;
                cout<<"    Has as its members:"<<endl;
                
                // Enumerate all User objects in each Group
                // object's Users Collection.
                if(m_pGroup->Users->Count != 0)
                {
                    for(lUsrIndex=0;lUsrIndex<=m_pGroup->Users->Count;
                        lUsrIndex++)
                    {
                        vIndex = lUsrIndex;
                        m_pUser = m_pGroup->Users->GetItem(vIndex);
                        cout<<"    "<<m_pUser->Name<<endl;
                    }
                }
                else
                {
                    cout<<"      [None]"<<endl;
                }
            }        // Delete new User and Group object because this 
            // is only a demonstration.
            m_pCatalog->Users->Delete("Pat Smith");
            m_pCatalog->Groups->Delete("Accounting");
        }    catch(_com_error &e)
        {
            // Notify the user of errors if any.
            _bstr_t bstrSource(e.Source());
            _bstr_t bstrDescription(e.Description());
              
            printf("\n\tSource :  %s \n\tdescription : %s \n ",
                 (LPCSTR)bstrSource,(LPCSTR)bstrDescription);
        }    catch(...)
        {
            cout << "Error occured in include files...."<< endl;
        }
    }
    // EndGroupCpp&copy; 1998-2001 Microsoft Corporation. All rights reserved.