Navigation Error
-
when the criteria for the where condition in a database query that i pumped in through
m_pSet->Open(...,QUERY,...);
and if no records match the criteria i'm gettin an error as Atttempt to scroll past end or before beginning of data in a dialog popped up. What can be the reason. the code is a follows.
query="Select * from Book where Name like '%"+name.Left(5)+"%'"; m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query,CRecordset::none); m_pSet->MoveFirst(); do { Item.Empty(); name=m_pSet->m_Name; auth=m_pSet->m_Author; Item=m_pSet->m_Ac_No+"\t"+name+"\t"+auth+"\t"+CLibManView::GetStatus(m_pSet->m_Stat); lb->AddString(Item); m_pSet->MoveNext(); }while(!m_pSet->IsEOF());
plz help
Success makes life easier. It doesn't make living easier. SH:)UVIK
-
when the criteria for the where condition in a database query that i pumped in through
m_pSet->Open(...,QUERY,...);
and if no records match the criteria i'm gettin an error as Atttempt to scroll past end or before beginning of data in a dialog popped up. What can be the reason. the code is a follows.
query="Select * from Book where Name like '%"+name.Left(5)+"%'"; m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query,CRecordset::none); m_pSet->MoveFirst(); do { Item.Empty(); name=m_pSet->m_Name; auth=m_pSet->m_Author; Item=m_pSet->m_Ac_No+"\t"+name+"\t"+auth+"\t"+CLibManView::GetStatus(m_pSet->m_Stat); lb->AddString(Item); m_pSet->MoveNext(); }while(!m_pSet->IsEOF());
plz help
Success makes life easier. It doesn't make living easier. SH:)UVIK
All seem to be on VACATION....;) Well well...Enjoy...Then do reply...
Success makes life easier. It doesn't make living easier. SH:)UVIK
-
when the criteria for the where condition in a database query that i pumped in through
m_pSet->Open(...,QUERY,...);
and if no records match the criteria i'm gettin an error as Atttempt to scroll past end or before beginning of data in a dialog popped up. What can be the reason. the code is a follows.
query="Select * from Book where Name like '%"+name.Left(5)+"%'"; m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query,CRecordset::none); m_pSet->MoveFirst(); do { Item.Empty(); name=m_pSet->m_Name; auth=m_pSet->m_Author; Item=m_pSet->m_Ac_No+"\t"+name+"\t"+auth+"\t"+CLibManView::GetStatus(m_pSet->m_Stat); lb->AddString(Item); m_pSet->MoveNext(); }while(!m_pSet->IsEOF());
plz help
Success makes life easier. It doesn't make living easier. SH:)UVIK
shouvik.d wrote:
and if no records match the criteria i'm gettin an error as Atttempt to scroll past end or before beginning of data
That's because you are calling
MoveFirst
when there are no records.
Nibu thomas A Developer Programming tips[^] My site[^]
-
shouvik.d wrote:
and if no records match the criteria i'm gettin an error as Atttempt to scroll past end or before beginning of data
That's because you are calling
MoveFirst
when there are no records.
Nibu thomas A Developer Programming tips[^] My site[^]
there are 8 records present in the DB already
Success makes life easier. It doesn't make living easier. SH:)UVIK
-
there are 8 records present in the DB already
Success makes life easier. It doesn't make living easier. SH:)UVIK
shouvik.d wrote:
there are 8 records present in the DB already
I am not talking about DB, but about the result returned by the query. Get the count of records before moving around in a recordset.
Nibu thomas A Developer Programming tips[^] My site[^]
-
shouvik.d wrote:
there are 8 records present in the DB already
I am not talking about DB, but about the result returned by the query. Get the count of records before moving around in a recordset.
Nibu thomas A Developer Programming tips[^] My site[^]
thanks prob solved :) I instead did this
m_pSet->Close(); query = "Select * from Book where Ac_no = '"+accnum+"'"; m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query,CRecordset::none); if(m_pSet->IsBOF() && m_pSet->IsEOF()) MessageBox("No records meeting the criteria"); else { m_pSet->MoveFirst(); do { name=m_pSet->m_Name; auth=m_pSet->m_Author; Item=accnum+"\t"+name+"\t"+auth+"\t"+CLibManView::GetStatus(m_pSet->m_Stat); lb->AddString(Item); m_pSet->MoveNext(); }while(!m_pSet->IsEOF()); }
Success makes life easier. It doesn't make living easier. SH:)UVIK
-
thanks prob solved :) I instead did this
m_pSet->Close(); query = "Select * from Book where Ac_no = '"+accnum+"'"; m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query,CRecordset::none); if(m_pSet->IsBOF() && m_pSet->IsEOF()) MessageBox("No records meeting the criteria"); else { m_pSet->MoveFirst(); do { name=m_pSet->m_Name; auth=m_pSet->m_Author; Item=accnum+"\t"+name+"\t"+auth+"\t"+CLibManView::GetStatus(m_pSet->m_Stat); lb->AddString(Item); m_pSet->MoveNext(); }while(!m_pSet->IsEOF()); }
Success makes life easier. It doesn't make living easier. SH:)UVIK
Yeah. Always check status of db query results before using them.
Nibu thomas A Developer Programming tips[^] My site[^]
-
Yeah. Always check status of db query results before using them.
Nibu thomas A Developer Programming tips[^] My site[^]
plz can u reply to the prev page post titled Data Exchange Plz
Man can acquire accomplishments or he can become an animal, whichever he wants. God makes the animals, man makes himself. G. C. Lichtenberg (1742-99), German physicist, philosopher. SH:)UVIK