A
ashish_chap
Hi,
I am using _bstr_t class in a function. This is used in an application
that is used in an multi-threaded environment. The function is
implemented as follows:
int Function(wchar_t *sqlCmd)
{
_bstr_t cmd ;
cmd = sqlCmd ;
CoInitialize(NULL);
..
..
..
return 0;
}
The above function uses ADO functions to execute SQL command. Here, in
statement
cmd = sqlCmd
while executing sqlCmd "Sometimes" an exception is thrown this happens
because though sqlCmd contains the sqlCmd to be executed. It is not
assigned to cmd which is passed to Execute function of ADODB.
Also, it crashes sometimes when the function returns and destructor for
_bstr_t is called.
Please, help me find out the answers to the following questions.
1) Is there any limitation for the overloaded '=' operation in _bstr_t,
due to which somestimes the sqlCmd is not assigned to cmd.
2)Before calling the destructor for _bstr_t is there any operation that
should be used to avoid the crash?
Thanks for you time.
Regards,
Ashish Choudhary
I am using _bstr_t class in a function. This is used in an application
that is used in an multi-threaded environment. The function is
implemented as follows:
int Function(wchar_t *sqlCmd)
{
_bstr_t cmd ;
cmd = sqlCmd ;
CoInitialize(NULL);
..
..
..
return 0;
}
The above function uses ADO functions to execute SQL command. Here, in
statement
cmd = sqlCmd
while executing sqlCmd "Sometimes" an exception is thrown this happens
because though sqlCmd contains the sqlCmd to be executed. It is not
assigned to cmd which is passed to Execute function of ADODB.
Also, it crashes sometimes when the function returns and destructor for
_bstr_t is called.
Please, help me find out the answers to the following questions.
1) Is there any limitation for the overloaded '=' operation in _bstr_t,
due to which somestimes the sqlCmd is not assigned to cmd.
2)Before calling the destructor for _bstr_t is there any operation that
should be used to avoid the crash?
Thanks for you time.
Regards,
Ashish Choudhary