CoCreateInstance failed!!!!

From: Dharani Babu S (dmanian_at_ivesia.com)
Date: 03/18/04


Date: Thu, 18 Mar 2004 18:38:16 +0530

Hi all
I am a newbie to oledb programming . My requirement is ..
1. Creation and accessing of database from Win Ce/ Embedded vc++ MFC based
application for pocket pc . I am trying to execute the CoCreateInstance
function but it failed .
I have added the following headers also ...
#define OLEDBVER 0x0210 // OLE DB driver version
#define DBINITCONSTANTS // Initialize OLE constants...
#define INITGUID // ...once in each app.
// FOR LISTVIEW CONTROL ONLY, CAN BE REMOVE IS NOT
 //APPLICABLE IN THE "ProcessRowset" FUNCTION.
#include <windows.h>
#include <urlmon.h>
#include <oledb.h>
#include <oledberr.h>
#include <ssceoledb.h>
#include <coguid.h>
#include <Oaidl.h>
#include <commctrl.h>
  and the code looks like this
hr = CoCreateInstance(CLSID_SQLSERVERCE_2_0,
        0,
        CLSCTX_INPROC_SERVER,
        IDD_IDBInitialize,
        (void**)&pIDBInitialize);
But the problem is I got the error " _IDD_IDBInitialize unknown indentifier
" then I checked the oledb.h and found that the line
 //IID_IDBInitialize =
{0x0c733a8b,0x2a1c,0x11c{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}} was
commented so i uncommented it and gto more errors so I copied the GUID value
to GUID
guid={0x0c733a8b,0x2a1c,0x11c{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}}
and passed the value in the place of IDD_IDBInitialize but still the
function failed . Could any of u help me ? I also learned that its
complicated to oledb programming in a MFC app. If so how to over come ? My
ultimate aim is to access a sql server database from sql server ce provider
from embedded vc++ 4.0 , any help is welcome .
with regards and thanks in advance
dharani



Relevant Pages

  • Re: How to access the SQL server express from mfc application?
    ... There are different ways to do this via MFC. ... You could certainly try ADO, ... the entire contents of the database to a SQL Server Standard Server. ...
    (microsoft.public.vc.mfc)
  • Re: How to access the SQL server express from mfc application?
    ... There are different ways to do this via MFC. ... You could certainly try ADO, ... the entire contents of the database to a SQL Server Standard Server. ...
    (microsoft.public.vc.mfc)
  • Re: How to move [quickly] from ISAM to SQL Express/MFC?
    ... the SQL all that different for SQL server. ... Take a look at some of the built in database classes with MFC. ...
    (microsoft.public.vc.mfc)
  • Re: How can I rename a database table?
    ... You may want to ask this in an SQL group, but perhaps you'll have to write a stored procedure to do this sort of thing and it could be that the queries you do through the MFC interface are more restricted. ... As a result of my limited database and MFC knowledge I am having ... theDataBase.ExecuteSQL("RENAME oldTableName TO newTableName"); ... Can anyone suggest a way of renaming this table programmatically? ...
    (microsoft.public.vc.mfc)
  • Class design question
    ... I'm creating a database application using MFC (Microsoft Foundation ... entry control (e.g. edit boxes, ... The interface to the database is the same for all these different control ...
    (comp.lang.cpp)