473,657 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create Instance Failed!

Hi, all
Could any boday tell me why I failed to create instance here in the
following code ?

Codes sample
--------------------------------------------------------------------
void CInsertDataTest Dlg::OnBnClicke dButton1()
{
_ConnectionPtr pMyConnect=NULL ;
HRESULT hr=pMyConnect.C reateInstance(_ _uuidof(Connect ion));
if(FAILED(hr))r eturn ;
AfxMessageBox(_ T("Successful l connected!"), MB_OK)
}
--------------------------------------------------------------------

Thanks in advance!

Joseph
Jul 20 '06 #1
3 5791
"Joseph Lu" <jo******@yahoo .comwrote in message
news:en******** ******@TK2MSFTN GP04.phx.gbl...
Could any boday tell me why I failed to create instance here in the
following code ?
...
--------------------------------------------------------------------
void CInsertDataTest Dlg::OnBnClicke dButton1()
{
_ConnectionPtr pMyConnect=NULL ;
HRESULT hr=pMyConnect.C reateInstance(_ _uuidof(Connect ion));
if(FAILED(hr))r eturn ;
AfxMessageBox(_ T("Successful l connected!"), MB_OK)
}
--------------------------------------------------------------------
Um, what is the value of hr?

Regards,
Will
Jul 20 '06 #2
the value of hr is : 0x800401f0 , my code is very simple, I used VC to
create a dialog based application and the create a new button on the dialog,
then I added a button click event to this app ,and I have listed the code as
my previous mail detailed .
"William DePalo [MVP VC++]" <wi***********@ mvps.orgдÈëÏûÏ ¢
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
"Joseph Lu" <jo******@yahoo .comwrote in message
news:en******** ******@TK2MSFTN GP04.phx.gbl...
> Could any boday tell me why I failed to create instance here in the
following code ?
...
--------------------------------------------------------------------
void CInsertDataTest Dlg::OnBnClicke dButton1()
{
_ConnectionPtr pMyConnect=NULL ;
HRESULT hr=pMyConnect.C reateInstance(_ _uuidof(Connect ion));
if(FAILED(hr))r eturn ;
AfxMessageBox(_ T("Successful l connected!"), MB_OK)
}
--------------------------------------------------------------------

Um, what is the value of hr?

Regards,
Will

Jul 20 '06 #3
Well , I got it, I find I need to call AfxOleInit() before create instance!

"Joseph Lu" <jo******@yahoo .comдÈëÏûÏ¢
news:ux******** ******@TK2MSFTN GP03.phx.gbl...
the value of hr is : 0x800401f0 , my code is very simple, I used VC to
create a dialog based application and the create a new button on the
dialog, then I added a button click event to this app ,and I have listed
the code as my previous mail detailed .
"William DePalo [MVP VC++]" <wi***********@ mvps.orgдÈëÏûÏ ¢
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>"Joseph Lu" <jo******@yahoo .comwrote in message
news:en******* *******@TK2MSFT NGP04.phx.gbl.. .
>> Could any boday tell me why I failed to create instance here in the
following code ?
...
--------------------------------------------------------------------
void CInsertDataTest Dlg::OnBnClicke dButton1()
{
_ConnectionPtr pMyConnect=NULL ;
HRESULT hr=pMyConnect.C reateInstance(_ _uuidof(Connect ion));
if(FAILED(hr))r eturn ;
AfxMessageBox(_ T("Successful l connected!"), MB_OK)
}
--------------------------------------------------------------------

Um, what is the value of hr?

Regards,
Will


Jul 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
13047
by: Shashikant Khandelwak | last post by:
Hi ! I am trying to install oracle 9i Standard edition on a windows 2000 SP4 machine. I get through the entire installation up to running the Database Configuration Assistant. While it tries to make the database, it gets to the "Creating and starting Oracle instance" stage, and then the errors start. I get: ORA-01503: CREATE CONTROLFILE failed. ORA-00205: error in identifying control file. check alertlog for more
15
3309
by: Viviana Vc | last post by:
How can I programatically do the equivalent of the following: cacls "C:\Program Files\test" /T /G Everyone:f ? Thanks, Viv
8
3185
by: Steve Neill | last post by:
Can anyone suggest how to create an arbitrary object at runtime WITHOUT using the deprecated eval() function. The eval() method works ok (see below), but is not ideal. function Client() { } Client.prototype.fullname = "John Smith"; var s = "Client"; eval("var o = new " + s + "();"); alert(o.fullname);
2
1794
by: R. Clausen | last post by:
I am wanting to create a database in UDB (WIN) v8 FP4 using a backup from UDB (WIN) v7.2 FP4. When the restore is complete, I get a DB2 Message 'The command completed successfully.', however, when I try to view a table in the Control Center I get a DB2 Message 'IBM CLI Driver SQL5035N The database requires migration to the current release.'. This migration message occurs when I restore the database into a newly created instance in v8 or...
9
3169
by: jab | last post by:
Je veux lier (join) une table qui se trouve dans une database avec une qui se trouve dans une autre database. Les 2 databases sont sur le même serveur en l'occurence DB2/NT 7.2.9. J'ai créé un wrapper avec le control center (j'ai utilisé DRDA) et ensuite j'ai voulu créé le serveur mais avec le wizard, il ne me présente pas mes tables ! J'ai donc essayé en ligne de commande. J'ai essayé la commande suivante: CREATE SERVER TEST TYPE...
20
8106
by: Hemant Shah | last post by:
Folks, I am using DB2 UDB 8.2 on AIX 5.1. How large of a bufferpool can you create? I tried to create a 4GB bufferpool db2 complained that is cannot allocate enogth memory. I have 16GB on this system. # db2 create bufferpool cfgbuffpool immediate size 1048576 pagesize 4096 SQL20189W The buffer pool operation (CREATE/ALTER) will not take effect until
4
12427
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
0
1349
by: Terry Reedy | last post by:
Fredrik Lundh wrote: If you do not want the instance created at all, you would have to write a custom .__new__ method, but that is tricky, something I would have to look up how to do, and most likely not needed. Fredrik's solution below is much easier and the one I would use if at all possible. At this point, you have an instance of your class bound to local name 'self'. Usually, its only individual attributes are (in 3.0, anyway,...
6
8808
by: Mr. X. | last post by:
Hello. How can I create aspnetdb from scratch ? (I want a script that create all table, views, etc... on that database). Thanks :)
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.