|
-
April 29th, 2005, 01:27 PM
#1
MFC : searching a database for the second time
Hello,
Let me first explain what I'm trying to do :
I have a main dialogbox with a list of all the ppl in my database. When I click on 1 of them, their address appears in a textbox beneath it.
How am I trying to do it :
First I make sure that the ID of that person is in the List control.
When I click on that person I retrieve the ID from the Listcontrol.
Then I pass that ID onto a function that searches the database for that ID, like this :
Code:
CString strFilter = "SELECT * FROM Personen WHERE ID LIKE '" ;
strFilter += strID ;
strFilter += "'" ;
m_pDB->Close() ;
m_pDB->Open(AFX_DB_USE_DEFAULT_TYPE, strFilter) ;
after that I just retrieve the address from the record that I found.
Problem :
When I click the first time on a person, everything works. But then when I click on a different person, my textbox stays the same. (I think the record just stays the same). I already tried a :
Code:
CString strFilter = "SELECT * FROM Personen" ;
m_pDB->Close() ;
m_pDB->Open(AFX_DB_USE_DEFAULT_TYPE, strFilter) ;
What am I still missing here?
thanx in advance for any help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|