insert into Message (msgTime,msg)select msgTime,msg from Message as B in 'c:/test.mdb' where not exists (select * from Message as A where (A.msgTime=B.msgTime))
我想插入test.mdb里的数据,test.mdb是带密码的,密码的字符串应该放在哪里?

解决方案 »

  1.   

    我不想开两个连接,上面这一句如果没有test.mdb没有密码的话可以运行,但有密码的话我不了解应该把密码放在哪个地方!
      

  2.   

    有两个数据文件,A.mdb,B.mdb,我用ADO连接了A.mdb,如何用一条语句把B.mdb里的数据插到A.mdb里?两个文件都有密码,
      

  3.   

    open source(),在SQl的帮助文件中仔细阅读一下帮助文件。
      

  4.   

    BOOL bSuccess = FALSE; if( lpTable == NULL || lpSqlExecute == NULL )
    return E_FAIL; IADORecordBinding   *picRs = NULL;
    _RecordsetPtr pRs("ADODB.Recordset");//初始化记录查询
    _ConnectionPtr pConn("ADODB.Connection" );//初始化记录连接
    _CommandPtr     pCmdChange  = NULL; CString  strSql,chSqlSentence; strSql = strSql +
    _T("Provider=Microsoft.Jet.OLEDB.4.0;") +
    _T("Data Source = ") + 
    m_szMdbPath +
    _T(";Persist Security Info=False;Jet OLEDB:Database Password=") +
    m_lpPass; try
    {
    pConn->Open((_bstr_t)strSql, "", "", adModeUnknown);//打开数据库
    pRs->QueryInterface(
    __uuidof(IADORecordBinding), (LPVOID*)&picRs); TESTHR(pCmdChange.CreateInstance(__uuidof(Command)));
    pCmdChange->ActiveConnection = pConn;
    pCmdChange->CommandText = lpSqlExecute; // Open titles table, casting Connection pointer to an 
    // IDispatch type so converted to correct type of variant.
    TESTHR(pRs.CreateInstance(__uuidof(Recordset)));
    pRs->Open ((_variant_t)lpTable, _variant_t((IDispatch *) pConn, true), adOpenStatic, adLockOptimistic, adCmdTable);
    // Clear extraneous errors from the Errors collection.
    pConn->Errors->Clear(); // Use the Connection object's execute method to
    // execute SQL statement to restore data.
    pConn->Execute(lpSqlExecute, NULL, adExecuteNoRecords); // Retrieve the current data by requerying the recordset.
    pRs->Requery(adCmdUnknown); //pRs->Update();
    pRs->Close(); bSuccess = TRUE;
    }
    catch (...)
    {
    if ( pRs != NULL )
    pRs->Close(); if ( pConn != NULL )
    pConn->Close(); pRs = NULL;
    pConn = NULL;
    return E_FAIL;
    } pConn->Close();
    return S_OK;
      

  5.   

    HRESULT ExecuteSqlCommand( LPCTSTR lpTable, LPCTSTR lpSqlExecute )
    {
    BOOL bSuccess = FALSE; if( lpTable == NULL || lpSqlExecute == NULL )
    return E_FAIL; IADORecordBinding   *picRs = NULL;
    _RecordsetPtr pRs("ADODB.Recordset");//初始化记录查询
    _ConnectionPtr pConn("ADODB.Connection" );//初始化记录连接
    _CommandPtr     pCmdChange  = NULL; CString  strSql,chSqlSentence; strSql = strSql +
    _T("Provider=Microsoft.Jet.OLEDB.4.0;") +
    _T("Data Source = ") + 
    m_szMdbPath +
    _T(";Persist Security Info=False;Jet OLEDB:Database Password=") +
    m_lpPass; try
    {
    pConn->Open((_bstr_t)strSql, "", "", adModeUnknown);//打开数据库
    pRs->QueryInterface(
    __uuidof(IADORecordBinding), (LPVOID*)&picRs); TESTHR(pCmdChange.CreateInstance(__uuidof(Command)));
    pCmdChange->ActiveConnection = pConn;
    pCmdChange->CommandText = lpSqlExecute; // Open titles table, casting Connection pointer to an 
    // IDispatch type so converted to correct type of variant.
    TESTHR(pRs.CreateInstance(__uuidof(Recordset)));
    pRs->Open ((_variant_t)lpTable, _variant_t((IDispatch *) pConn, true), adOpenStatic, adLockOptimistic, adCmdTable);
    // Clear extraneous errors from the Errors collection.
    pConn->Errors->Clear(); // Use the Connection object's execute method to
    // execute SQL statement to restore data.
    pConn->Execute(lpSqlExecute, NULL, adExecuteNoRecords); // Retrieve the current data by requerying the recordset.
    pRs->Requery(adCmdUnknown); //pRs->Update();
    pRs->Close(); bSuccess = TRUE;
    }
    catch (...)
    {
    if ( pRs != NULL )
    pRs->Close(); if ( pConn != NULL )
    pConn->Close(); pRs = NULL;
    pConn = NULL;
    return E_FAIL;
    } pConn->Close();
    return S_OK;
    }
      

  6.   

    select * from Message in 'c;/test.mdb'
    我現在想知道test.mdb有密碼,語句應該怎麼改寫?
      

  7.   


    两个ACCESS表:   
      select a.*, b.*  from tb as a, [;database=e:\a.mdb;pwd=123].tb as b;