Armenian Knowledge Base  

Go Back   Armenian Knowledge Base > Technical sections > Languages, Compilers, Interpreters > C/C++
Register

Reply
 
LinkBack Thread Tools
Old 02.05.2006, 11:36   #1
Младенец
 
Join Date: 04 2006
Location: Mauritius
Age: 34
Posts: 12
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default C++ Builder 6 - Database Search

Hi,
I have a table called event in my database.
I have 2 fields called Event_Id and Project_Id.
I want to search the table to find out if there's event_id=27 for a project_id.

Kind Regards,
Rowin
Reply With Quote
Old 02.05.2006, 14:16   #2
Младенец
 
tiko_www's Avatar
 
Join Date: 03 2006
Location: Yerevan
Age: 32
Posts: 20
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default Re: C++ Builder 6 - Database Search

CDatabase* pDatabase ;
...
...
CRecordset m_rs (pDatabase);

m_rs.Open(AFX_DB_USE_DEFAULT_TYPE, "select project_id from table_name where event_id = 27", NULL);

or

m_rs.Open();
m_rs.m_strFilter = "event_id = 27";
m_rs.Requery();


CDBVariant varValue;

while(!m_rs.IsEOF())
{
m_rs.GetFieldValue(2/*2 is column*/, varValue );
...
//cout << varValue.m_lVal;
...

m_rs.MoveNext();
}

Last edited by tiko_www; 02.05.2006 at 15:11.
Reply With Quote
Old 02.05.2006, 22:10   #3
Грустно...
 
Agregat's Avatar
 
Join Date: 08 2002
Location: Там, где всегда идут дожди
Age: 35
Posts: 21,717
Downloads: 2
Uploads: 0
Reputation: 250 | 7
Default Re: C++ Builder 6 - Database Search

Not sure how MFC fits inside BCB, but whatever
Reply With Quote
Old 03.05.2006, 10:09   #4
Младенец
 
Join Date: 04 2006
Location: Mauritius
Age: 34
Posts: 12
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default Re: C++ Builder 6 - Database Search

Thanks, I'll try it.

Kind Regards,
Rowin
Reply With Quote
Sponsored Links
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 03:16.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.