Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TSQLQuery and update of data


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Mats karlsson

Posts: 64
Registered: 11/8/99
TSQLQuery and update of data  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 15, 2016 1:33 PM
I have a db containing notes for say customers. The db design involve one table for notes, a link table customer_note and a customers table.
The query to obtain the notes for a selected customer is:
SELECT * FROM note n 
INNER JOIN customer_note cn 
ON (cn.note_id = n.id) 
WHERE customer_id = :customerID 
ORDER BY created_on ASC


The query is executed in an event where the customers database is scrolled, i.e.
    customersCDSAfterScroll()
{
	int cID = customerCDS->FieldByName("id")->AsInteger;
	customerNotesQ->Params->ParamByName("customerID")->AsInteger = bID;
    customerNotesQ->Open();
 
    //Get notes
	string note = stdstr(customerNotesQ->FieldByName("note")->AsString);
    Log(lInfo) << "Note is: "<<note;
	customerNotesQ->Close();
}


The query is referenced by a DataSetProvider, a ClientDataSet and a DataSource component. On the UI a TDBLookupListbox is receiving the data.

Problem is, the TDBLookpListbox shows ALL notes for all customers. Any idea what is going on??
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02