In My program ,I use a ado connection
If I use 1 (as follows) ,use a access mdb ,it work ok
If I use 2 and 3 ,use a oledb to a sqlserver ADotest which is transfered
from
ADOTest.mdb. , the connection is ok ,But
error occur in this command (IDispatch error #3081 )
pRecordset->Open ((IDispatch *) pCommand, vtMissing, adOpenForwardOnly,
adLockReadOnly, adCmdUnknown);
1.if (FAILED (m_pConn->Open (_bstr_t ("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source = ADOTestDB.MDB"),_bstr_t (""), _bstr_t (""), adModeUnknown)))
2.if (FAILED (m_pConn->Open (_bstr_t
("Provider=sqloledb;Initial Catalog=ADOTest;User
ID=sjk;Password="),_bstr_t (""), _bstr_t (""), adModeUnknown)))
3.if (FAILED (m_pConn->Open (_bstr_t ("Provider=MSDASQL; Dsn=ADOTest;User
ID=sjk;Password="),_bstr_t (""), _bstr_t (""), adModeUnknown)))
Part of the code is as follows:
thanks you very much
// ADOTestDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ADOTest.h"
#include "ADOTestDlg.h"
#include "storedprocdlg.h"
#include "updatedlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
////////////////////////////////////////////////////////////////////////////
/
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
file://{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
file://}}AFX_DATA
// ClassWizard generated virtual function overrides
file://{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
file://}}AFX_VIRTUAL
// Implementation
protected:
file://{{AFX_MSG(CAboutDlg)
file://}}AFX_MSG
DECLARE_MESSAGE_MAP()
I am not able to reproduce the problem. I think the 3081 error is ADO
error. However, I cannot find the number in ADO docs. Could you debug it
and check the error message?
Refer to the following link to check the error message:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
mdmthopenxvc.asp
Hope is helps.
Best Regards,
Bill
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
©2001 Microsoft Corporatioin. All rights reserved.