BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need professional optimized approach to this problem [dbgrid

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi (General)
View previous topic :: View next topic  
Author Message
Nostra Damus
Guest





PostPosted: Thu Aug 21, 2003 8:06 pm    Post subject: Need professional optimized approach to this problem [dbgrid Reply with quote



I need to take the values from a column of selected rows from a DBGrid
( dgMultiselect is set ) and use them as parameters for another query.

Scenario: DBGrid is displaying the resultset of a Query. When user
selects some rows, every time he releases the mouse button, another
query should execute taking values from (the first column of) these
selected rows.

This is what I have in the dbgridMouseUp event handler:
*********************begin code*********************
for c := 0 to dbgrid1.SelectedRows.Count-1 do
begin
dbgrid1.DataSource.DataSet.GotoBookmark(
pointer(dbgrid1.SelectedRows[c]) );
// ????? dbgrid1.DataSource.DataSet.FieldByName('invoiceNo').Value
// here, i want selected Invoice Nos. to be passed as a
// parameter(s) to another query, a dynamic array of Integers maybe?
// Which brings me to another problem, how do I pass multiple integer
// values as a parameter to a query considering I am using the
// SELECT * FROM myTable WHERE myField IN (x,y,z);
// syntax? Is there another way this can be done and can I scrap this
// query?
end;
*********************end code*********************

Any suggestions appreciated.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi (General) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.