CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2007
    Posts
    15

    Arrow ATL COM Connectionpoint Error

    Hi,

    I have written a code on com connection point to connect to the database and insert the given values into the table.I have written the below code in the insert button handler.But , I am getting the erroes like

    '_Connection' : undeclared identifier
    'CComPtr' : use of class template requires template argument list
    CComPtr' : no appropriate default constructor available

    LRESULT OnInsert(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
    {
    BSTR str;
    BSTR str1;


    GetDlgItemText(IDC_EDIT1,str);
    GetDlgItemText(IDC_EDIT2,str1);

    CoInitialize(NULL);
    CComPtr<_Connection>pCon;
    pCon.CoCreateInstance(__uuidof(Connection));
    pCon->Open("MYNEWDATASOURCE","","",-1);
    CComPtr<_Recordset>pRec;
    pRec.CoCreateInstance(__uuidof(Recordset));
    char str2[255];
    sprinf(str2,"insert into NEWTABLENAME (SNO,SNAME) values (&s,&s)",str1,str);

    _vriant_t vQuery;
    vQuery.SetString(str2);

    pRec->Open(vQuery,(CComVariant)pCon,adOpenStatic,adLockReadOnly,adCmdUnknown);
    return 0;
    }
    If some one knows help me.
    Last edited by shamsheerbabu; March 12th, 2007 at 04:27 AM.

  2. #2
    Join Date
    Mar 2003
    Location
    The Netherlands
    Posts
    586

    Re: COM Connectionpoint Error

    I think you have to add some includes to your sourcefiles. You have to find out if _ComPtr is declared in one of the following headerfiles: atlbase.h, atlcom.h. Otherwise try a google or msdn search on 'ATL source code files'. Hope this helps.
    Time is fun when you're having flies

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured