Click here to Skip to main content
15,923,083 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: performing calculations faster Pin
Mridang Agarwalla6-May-05 17:07
Mridang Agarwalla6-May-05 17:07 
GeneralRe: performing calculations faster Pin
PJ Arends6-May-05 11:17
professionalPJ Arends6-May-05 11:17 
Generalstatus of FTP Pin
NLMurthy6-May-05 9:02
NLMurthy6-May-05 9:02 
GeneralRe: status of FTP Pin
RaajaOfSelf6-May-05 9:29
RaajaOfSelf6-May-05 9:29 
GeneralRe: status of FTP Pin
Ravi Bhavnani7-May-05 3:57
professionalRavi Bhavnani7-May-05 3:57 
Generalfunction returning CRecordset Pin
scoroop6-May-05 8:27
scoroop6-May-05 8:27 
GeneralRe: function returning CRecordset Pin
David Crow6-May-05 10:02
David Crow6-May-05 10:02 
GeneralRe: function returning CRecordset Pin
scoroop6-May-05 15:31
scoroop6-May-05 15:31 
first of all Smile | :) ... what is sth? in every english/foreign language dictionary they use "sth" instead of "something" Smile | :) .

ok and now straight to the point:

i need a function that queries database and that returns results as CRecordset:

<br />
CRecordset* CDB::Query(CString path, CString SQLstring)<br />
{<br />
...some declarations... <br />
<br />
TRY <br />
{<br />
...i open database and then:<br />
<br />
CRecordset* recset = new CRecordset(&db);<br />
recset.Open(CRecordset::forwardOnly, SQLstring, CRecordset::readOnly);<br />
return recset; <br />
db.Close();<br />
}<br />
CATCH(CDBException, dbex)<br />
 {<br />
  AfxMessageBox("Error: " + dbex->m_strError);<br />
 }<br />
 END_CATCH;<br />
}<br />


Than in the other class i'd like to use it...

<br />
CDB d;<br />
CRecordset *recset = d.Query(path,sqlstring);<br />


the result is that program compiles, when i run procedure form the second code snippet it's fine but recordset is "poisoned" Smile | :) . when i use any method of CRecordset class i get "debug assertion failed" error. i'm not too good in pointer stuff so it's quite possible it's something trivial Smile | :) .
GeneralRe: function returning CRecordset Pin
David Crow6-May-05 16:33
David Crow6-May-05 16:33 
GeneralRe: function returning CRecordset Pin
scoroop7-May-05 0:34
scoroop7-May-05 0:34 
GeneralRe: function returning CRecordset Pin
David Crow7-May-05 7:59
David Crow7-May-05 7:59 
GeneralRe: function returning CRecordset Pin
scoroop7-May-05 8:20
scoroop7-May-05 8:20 
GeneralRe: function returning CRecordset Pin
David Crow7-May-05 10:47
David Crow7-May-05 10:47 
GeneralRe: function returning CRecordset Pin
scoroop7-May-05 11:28
scoroop7-May-05 11:28 
GeneralRe: function returning CRecordset Pin
David Crow9-May-05 2:17
David Crow9-May-05 2:17 
GeneralRe: function returning CRecordset Pin
scoroop9-May-05 5:49
scoroop9-May-05 5:49 
Generalpassing a callback function pointer to a DLL within an MFC application Pin
DKaiser6-May-05 6:47
DKaiser6-May-05 6:47 
GeneralRe: passing a callback function pointer to a DLL within an MFC application Pin
Chris Losinger6-May-05 7:45
professionalChris Losinger6-May-05 7:45 
GeneralSecurity Template Pin
arthivjii6-May-05 6:45
arthivjii6-May-05 6:45 
GeneralMoving Items in a virtual List-View Pin
Luy6-May-05 5:38
Luy6-May-05 5:38 
Questionhow to embed a dialog into the frame? Pin
steven_wong6-May-05 4:19
steven_wong6-May-05 4:19 
GeneralTexture mapping and color replacing with GDI Pin
DaViL836-May-05 3:40
DaViL836-May-05 3:40 
Generalown class Pin
_tasleem6-May-05 2:36
_tasleem6-May-05 2:36 
GeneralRe: own class Pin
benjymous6-May-05 2:42
benjymous6-May-05 2:42 
GeneralRe: own class Pin
_tasleem6-May-05 3:29
_tasleem6-May-05 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.