Click here to Skip to main content
16,005,181 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalproblem with null (uninitialized) objects Pin
Berkut25-Apr-03 7:40
Berkut25-Apr-03 7:40 
GeneralRe: problem with null (uninitialized) objects Pin
Berkut25-Apr-03 7:41
Berkut25-Apr-03 7:41 
GeneralRe: problem with null (uninitialized) objects Pin
David Crow25-Apr-03 7:51
David Crow25-Apr-03 7:51 
Generalfor DavidCrow Pin
Toni7825-Apr-03 8:20
Toni7825-Apr-03 8:20 
GeneralRe: for DavidCrow Pin
David Crow25-Apr-03 8:33
David Crow25-Apr-03 8:33 
GeneralThank you DavidCrow Pin
Toni7825-Apr-03 9:04
Toni7825-Apr-03 9:04 
GeneralRe: problem with null (uninitialized) objects Pin
Michael Dunn25-Apr-03 10:55
sitebuilderMichael Dunn25-Apr-03 10:55 
GeneralFilter and Delete Question Pin
Toni7825-Apr-03 7:07
Toni7825-Apr-03 7:07 
I am writing a database program using ADO and Visual C++.
Let me explain my problem.

// _ConnectionPtr m_pConn;
m_pConn->Open(L"Provider=Microsoft.Jet.OLEDB.4.0;
		Data Source=Inventory.mdb;",
                 L"", L"", adOpenUnspecified );
...
// _RecordsetPtr pRs
// and bstrQuery is some SQL SELECT statement
pRs->Open( _variant_t( bstrQuery ),
		vNull,
		adOpenDynamic,
		adLockOptimistic,
		adCmdUnknown );

// When I delete a record this is how I do it. Just
// an example. And it works just fine.
if( m_pRs->Supports( adDelete ) && m_nNoRows > 1 )
{
	// Delete the current record
	m_pRs->Delete( adAffectCurrent );
	m_pRs->MoveNext();
	if( m_pRs->GetADOEOF() )
		m_pRs->MovePrevious();
} // end if
//
// At some point I set a filter and I do it this way:
CString strFilter = "vField LIKE 'smth%';
m_pRs->Filter = _variant_t( (_bstr_t)strFilter );
//
After I set the filter and I delete a record, if I try to
move to the previous record (even though the record is not
the first) I get an error which suggests that the row where
I am trying to move is either marked for deletion or has
been deleted.  Why? The database supports MovePrevious and
I don't use batch mode. This problem occurs only if I
set a filter.  The filter works fine too. It selects only
the records that I want it to select.


// Afterall I realized that even my comment lines have bugs
GeneralModifyStyleEx Pin
ZarrinPour25-Apr-03 6:46
ZarrinPour25-Apr-03 6:46 
GeneralRe: ModifyStyleEx Pin
Joel Lucsy25-Apr-03 9:50
Joel Lucsy25-Apr-03 9:50 
GeneralSystem Tray Pin
dudic25-Apr-03 6:28
dudic25-Apr-03 6:28 
GeneralRe: System Tray Pin
valikac25-Apr-03 7:18
valikac25-Apr-03 7:18 
GeneralRe: System Tray Pin
dudic25-Apr-03 7:27
dudic25-Apr-03 7:27 
GeneralRe: System Tray Pin
dudic25-Apr-03 7:37
dudic25-Apr-03 7:37 
GeneralRe: System Tray Pin
David Crow25-Apr-03 7:38
David Crow25-Apr-03 7:38 
GeneralRe: System Tray Pin
David Crow25-Apr-03 7:37
David Crow25-Apr-03 7:37 
GeneralTask Bar problem Pin
dudic25-Apr-03 6:06
dudic25-Apr-03 6:06 
GeneralRe: Task Bar problem Pin
Anna-Jayne Metcalfe25-Apr-03 10:57
Anna-Jayne Metcalfe25-Apr-03 10:57 
GeneralRe: Task Bar problem Pin
Phil Hamer25-Apr-03 13:54
Phil Hamer25-Apr-03 13:54 
Generalmanaged c++ app and STL Pin
ns25-Apr-03 5:46
ns25-Apr-03 5:46 
GeneralRe: managed c++ app and STL Pin
Nemanja Trifunovic25-Apr-03 6:04
Nemanja Trifunovic25-Apr-03 6:04 
Generalgreat! Thanks! Pin
ns25-Apr-03 6:45
ns25-Apr-03 6:45 
GeneralLooking for a tooltip kind'of control... Pin
Maximilien25-Apr-03 5:41
Maximilien25-Apr-03 5:41 
GeneralRe: Looking for a tooltip kind'of control... Pin
Chris Richardson25-Apr-03 14:06
Chris Richardson25-Apr-03 14:06 
GeneralRe: Looking for a tooltip kind'of control... Pin
Maximilien25-Apr-03 14:50
Maximilien25-Apr-03 14:50 

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.