| Matt Neerincx [MS] 2005-08-22, 3:23 am |
| No, that is the right way to do it. It should not hang. You can run into
strange problems with ODBC drivers if you are not very careful with ODBC
handles (like HDBC and HSTMT). The CRecordset and CDatabase classes are
wrapper classes for HSTMT and HDBC.
One KEY thing is this. If you close a CDatabase then all child CRecordset
objects are immediately invalidated, attempting to close these could cause
some handle problems (I'm not totally sure because I have not used these
classes in 3-4 years, but I seem to recall this issue).
Matt Neerincx [MSFT]
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
<baraklo@gmail.com> wrote in message
news:1123267601.348471.244820@z14g2000cwz.googlegroups.com...
> Our app that uses MFC ODBC classes(CDATABASE, CRECORDSET) often hangs
> after the folllowing sequence:
>
> - open connection
> - connection to DB lost due to network problems
> - close connection
> - open connection
> - open recordset
>
> App hangs in CRecordset::PrepareA
ndExecute() while executing
> SQLExecDirect
>
> Anybody experienced anything like that? Maybe DB disconnects are
> supposed to be handled differently?
>
|