ASSERTION in an ODBC App.
Jason R Simpson -- doecreek@sun.tir.com
Thursday, April 04, 1996
-- [ From: Jason R Simpson * EMC.Ver #2.5.02 ] --
VC++ 4.1
Win95
I have a problem tracking database that has been working fine now for
several months. Today, everyone has been asking me what is wrong with it.
I run it in debug and I get an assertion failure. Here is some background:
1. I open the data source...
// Here is where I initially open the data source. void CKBaseView::
OnInitialUpdate()
{
m_pSet = &GetDocument()->m_kBaseSet;
m_nSortMethod = IncidentSort;
m_pSet->m_strSort = GetSortString();
TRY
{
if( !m_pSet->IsOpen() )
{
m_pSet->Open();
// I verify that it does open successfully.
ASSERT(m_pSet->IsOpen());
}
}
CATCH(CDBException, e)
{
AfxMessageBox(e->m_strError);
return;
}
END_CATCH
// The Incident Number is always read only.
((CEdit *)GetDlgItem(IDC_INCIDENT))->SetReadOnly(TRUE);
UpdateData(FALSE);
SetEditModeUI(NormalMode);
CRecordView::OnInitialUpdate();
}
2. The application framework calls this function to determine how to draw
the menu.
void CKBaseView::OnUpdateRecordNext(CCmdUI* pCmdUI)
{
// This assumes that records in the view are sorted by
// Incident Number.
if( m_nEditMode == AddMode || IsOnLastRecord() )
{
pCmdUI->Enable(FALSE);
}
else
{
pCmdUI->Enable(TRUE);
}
}
3. CRecordView::IsOnLastRecord() then calls CRecordSet::GetStatus() ...
BOOL CRecordView::IsOnLastRecord()
{
ASSERT_VALID(this);
CRecordset* pRecordset = OnGetRecordset();
CRecordsetStatus status;
pRecordset->GetStatus(status);
if (!status.m_bRecordCountFinal)
return FALSE;
return ((status.m_lCurrentRecord+1 == pRecordset->GetRecordCount()));
}
4. And get status fails on an ASSERTION...
_AFXDBCORE_INLINE void CRecordset::GetStatus(CRecordsetStatus& rStatus)
const
{ ASSERT(IsOpen());
rStatus.m_lCurrentRecord = m_lCurrentRecord;
rStatus.m_bRecordCountFinal = m_bEOFSeen; }
I do not understand how the data source would not be open at this point and
why it has worked until now. The only thing that has changed is that I
originally compiled the application in VC++4.0 and I recently re-compiled in
VC++4.1.
Dan Kirby -- dkirby@accessone.com
Saturday, April 06, 1996
Jason, I would mind taking a look at your code if you can reproduce this in
a simple case. What is the data source that you are using? Has this
changed?
Do you get any TRACE messages in the output window when you run your
application under the debugger? Is it the SQLNumResultCols call that is
failing?
--dan
----------
From: Jason R Simpson[SMTP:]
Sent: Thursday, April 04, 1996 6:03 AM
To: mfc-l@netcom.com
Subject: ASSERTION in an ODBC App.
-- [ From: Jason R Simpson * EMC.Ver #2.5.02 ] --
VC++ 4.1
Win95
I have a problem tracking database that has been working fine now for
several months. Today, everyone has been asking me what is wrong with it.
I run it in debug and I get an assertion failure. Here is some background:
1. I open the data source...
// Here is where I initially open the data source. void CKBaseView::
OnInitialUpdate()
{
m_pSet = &GetDocument()->m_kBaseSet;
m_nSortMethod = IncidentSort;
m_pSet->m_strSort = GetSortString();
TRY
{
if( !m_pSet->IsOpen() )
{
m_pSet->Open();
// I verify that it does open successfully.
ASSERT(m_pSet->IsOpen());
}
}
CATCH(CDBException, e)
{
AfxMessageBox(e->m_strError);
return;
}
END_CATCH
// The Incident Number is always read only.
((CEdit *)GetDlgItem(IDC_INCIDENT))->SetReadOnly(TRUE);
UpdateData(FALSE);
SetEditModeUI(NormalMode);
CRecordView::OnInitialUpdate();
}
2. The application framework calls this function to determine how to draw
the menu.
void CKBaseView::OnUpdateRecordNext(CCmdUI* pCmdUI)
{
// This assumes that records in the view are sorted by
// Incident Number.
if( m_nEditMode == AddMode || IsOnLastRecord() )
{
pCmdUI->Enable(FALSE);
}
else
{
pCmdUI->Enable(TRUE);
}
}
3. CRecordView::IsOnLastRecord() then calls CRecordSet::GetStatus() ...
BOOL CRecordView::IsOnLastRecord()
{
ASSERT_VALID(this);
CRecordset* pRecordset = OnGetRecordset();
CRecordsetStatus status;
pRecordset->GetStatus(status);
if (!status.m_bRecordCountFinal)
return FALSE;
return ((status.m_lCurrentRecord+1 == pRecordset->GetRecordCount()));
}
4. And get status fails on an ASSERTION...
_AFXDBCORE_INLINE void CRecordset::GetStatus(CRecordsetStatus& rStatus)
const
{ ASSERT(IsOpen());
rStatus.m_lCurrentRecord = m_lCurrentRecord;
rStatus.m_bRecordCountFinal = m_bEOFSeen; }
I do not understand how the data source would not be open at this point and
why it has worked until now. The only thing that has changed is that I
originally compiled the application in VC++4.0 and I recently re-compiled
in
VC++4.1.
begin 600 WINMAIL.DAT
M>)\^(@T2`0:0" `$```````!``$``0>0!@`(````Y 0```````#H``$(@ <`
M& ```$E032Y-:6-R;W-O9G0@36%I;"Y.;W1E`#$(`0V ! `"`````@`"``$$
MD 8`? (```(````,`````P``, ,````+``\.``````(!_P\!````/P``````
M``"!*Q^DOJ,0&9UN`-T!#U0"`````&UF8RUL0&YE=&-O;2YC;VT`4TU44 !M
M9F,M;$!N971C;VTN8V]M```>``(P`0````4```!33510`````!X``S !````
M$0```&UF8RUL0&YE=&-O;2YC;VT``````P`5# $````#`/X/!@```!X``3 !
M````$P```"=M9F,M;$!N971C;VTN8V]M)P```@$+, $````6````4TU44#I-
M1D,M3$!.151#3TTN0T]-`````P``.0`````+`$ Z`0````(!]@\!````! ``
M``````,-`````P``, 0````+``\.`0````(!_P\!````1P````````"!*Q^D
MOJ,0&9UN`-T!#U0"```!`&1O96-R965K0'-U;BYT:7(N8V]M`%--5% `9&]E
M8W)E96M ````4D4Z($%34T525$E/3B!I;B!A;B!/
M1$)#($%P<"X`-@@!!8 #``X```#,!P0`!@`'````"0`&`/,``2" `P`.````
MS <$``8`!@`Y`"H`!@!,`0$)@ $`(0```#0V,S4P1#$X-S@X1D-&,3$Y,C(X
M-#0T-34S-30P,# P`+X&`0.0!@`8"0``% ````L`(P```````P`F```````+
M`"D```````,`+@```````P`V``````! `#D``/UUO\DCNP$>`' ``0```!X`
M``!213H@05-315)424].(&EN(&%N($]$0D,@07!P+@````(!<0`!````%@``
M``&[(\F^'A@--4>/>!'/DBA$15-4`````!X`'@P!````!0```%--5% `````
M'@`?# $````5````9&MIL"@P!0$P-4`@!C: K 0'1I`B BX(<;\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'+>-)PL9N6;:"1;;!!9&2SLWQ\*S']GP!,&O"7P9YB>@^)SZL5>6ZP16X!
MH" `FB^.SV7]+,!EM@^W'[@JF&^%R:"M_C,@<9X[M.\A(0.@HW2>-=]M<6I0
M=((!D(W@<[7!92_P0D]/3,#_M1NKKTDX[%]6N/"6H"@?(HRC]_C;4V<+CR1"L:P+0!?]$M
MU+F$@: /+J920"" 0?\;\252S_0MLX"12B-)=\4?$%]!1EA*@4]21?N6T9)"H4%L&EGU7)GT42Q_G #$+ !(2(I.A]Q4?)20+XP7P6N03P19]$6
M`"W\A_\+@%&)4D%*_0'_`P]+;TQX+QHU,V8*A14A``?0``,`$! ``````P`1
M$ $```! ```#T``0````4```!213H@
.``````,`#33]-P``]@\C
`
end
Jason R Simpson -- doecreek@sun.tir.com
Monday, April 08, 1996
-- [ From: Jason R Simpson * EMC.Ver #2.5.02 ] --
VC++ 4.1
Win95
Here is the output of the TRACE window after running in debug:
Loaded symbols for 'C:\WIN95\SYSTEM\MFCO40D.DLL'
Loaded symbols for 'C:\WIN95\SYSTEM\MFCD40D.DLL'
Loaded symbols for 'C:\WIN95\SYSTEM\MSVCR40D.DLL'
Loaded symbols for 'C:\WIN95\SYSTEM\MFC40D.DLL'
Loaded symbols for 'C:\WIN95\SYSTEM\msjter32.dll'
Warning: ODBC Success With Info, Driver's SQLSetConnectOption failed
State:IM006,Native:0,Origin:[Microsoft][ODBC Driver Manager]
Driver not capable
State:S1C00,Native:84,Origin:[Microsoft][ODBC Driver pack 2.0 Driver]
DBMS: ACCESS
, Version: 3.0
First-chance exception in KBase.exe (MFC40D.DLL): 0xE06D7363: Microsoft C++
Exception.
First-chance exception in KBase.exe (MFCD40D.DLL): 0xE06D7363: Microsoft C++
Exception.
Warning: Uncaught exception in WindowProc (returning 0).
If this is not helpful, I will attempt to reproduce my example with a small
program.
Thanks,
Jason Simpson
-------- REPLY, Original message follows --------
Date: Saturday, 06-Apr-96 07:00 AM
From: Dan Kirby \ Internet: (dkirby@accessone.com)
To: 'mfc-l@netcom.com' \ Internet: (mfc-l@netcom.com)
To: 'doecreek@sun.tir.com' \ Internet: ('doecreek@sun.tir.com')
Subject: RE: ASSERTION in an ODBC App.
Jason, I would mind taking a look at your code if you can reproduce this in
a simple case. What is the data source that you are using? Has this
changed? Do you get any TRACE messages in the output window when you run
your application under the debugger? Is it the SQLNumResultCols call that
is failing?
--dan
----------
From: Jason R Simpson[SMTP:]
Sent: Thursday, April 04, 1996 6:03 AM
To: mfc-l@netcom.com
Subject: ASSERTION in an ODBC App.
-- [ From: Jason R Simpson * EMC.Ver #2.5.02 ] --
VC++ 4.1
Win95
I have a problem tracking database that has been working fine now for
several months. Today, everyone has been asking me what is wrong with it. I
run it in debug and I get an assertion failure. Here is some background:
1. I open the data source...
// Here is where I initially open the data source. void CKBaseView::
OnInitialUpdate()
{
m_pSet = &GetDocument()->m_kBaseSet;
m_nSortMethod = IncidentSort;
m_pSet->m_strSort = GetSortString();
TRY
{
if( !m_pSet->IsOpen() )
{
m_pSet->Open();
// I verify that it does open successfully.
ASSERT(m_pSet->IsOpen());
}
}
CATCH(CDBException, e)
{
AfxMessageBox(e->m_strError);
return;
}
END_CATCH
// The Incident Number is always read only.
((CEdit *)GetDlgItem(IDC_INCIDENT))->SetReadOnly(TRUE);
UpdateData(FALSE);
SetEditModeUI(NormalMode);
CRecordView::OnInitialUpdate();
}
2. The application framework calls this function to determine how to draw
the menu.
void CKBaseView::OnUpdateRecordNext(CCmdUI* pCmdUI)
{
// This assumes that records in the view are sorted by
// Incident Number.
if( m_nEditMode == AddMode || IsOnLastRecord() )
{
pCmdUI->Enable(FALSE);
}
else
{
pCmdUI->Enable(TRUE);
}
}
3. CRecordView::IsOnLastRecord() then calls CRecordSet::GetStatus() ...
BOOL CRecordView::IsOnLastRecord()
{
ASSERT_VALID(this);
CRecordset* pRecordset = OnGetRecordset();
CRecordsetStatus status;
pRecordset->GetStatus(status);
if (!status.m_bRecordCountFinal)
return FALSE;
return ((status.m_lCurrentRecord+1 == pRecordset->GetRecordCount()));
}
4. And get status fails on an ASSERTION...
_AFXDBCORE_INLINE void CRecordset::GetStatus(CRecordsetStatus& rStatus)
const
{ ASSERT(IsOpen());
rStatus.m_lCurrentRecord = m_lCurrentRecord;
rStatus.m_bRecordCountFinal = m_bEOFSeen; }
I do not understand how the data source would not be open at this point and
why it has worked until now. The only thing that has changed is that I
originally compiled the application in VC++4.0 and I recently re-compiled
in VC++4.1.
-------- REPLY, End of original message --------
------- FORWARD, End of original message -------
| Вернуться в корень Архива
|