Korzh.com developer tools forums :: View topic - SQL List in DME and distinct list of values in Query Panel
Korzh.com
home : Community forums  FAQFAQ   SearchSearch  |  RegisterRegister  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
SQL List in DME and distinct list of values in Query Panel

 
Post new topic   Reply to topic    Korzh.com developer tools Forum Index -> EasyQuery WPF
View previous topic :: View next topic  
Author Message
Abiss
Novice


Joined: 09 Nov 2011
Posts: 3

PostPosted: Fri Jul 06, 2012 3:47 pm    Post subject: SQL List in DME and distinct list of values in Query Panel Reply with quote

Hi,

I have read many posts about using the SQL List option to get a drop down pick list of all the values available for a column when building a query in the query panel....however I must be missing something because I can't quite follow if everything in the posts is available in WPF version.

I have tried putting in the SQL List option in the DME and then in the Settings SQL using (is this the right thing to do?):

Select DISTINCT MyColumn
From "myTable.dbf"

I know there is mention of using the SQLExecute event for the QueryPanel (http://devtools.korzh.com/forums/viewtopic.php?t=656&start=0&postdays=0&postorder=asc&highlight=sql+list) but I must be missing something because I do not see it as an event for the QueryPanel?

Is there an example of how this is done somewhere that I'm missing or has anyone done this very thing using EasyQuery.NET WPF before? I'm having some trouble piecing this together.

Thanks in advance....
Back to top
View user's profile Send private message
Admin
Site Admin


Joined: 07 Nov 2005
Posts: 272

PostPosted: Tue Aug 21, 2012 4:32 pm    Post subject: Reply with quote

WPF edition uses different approach. It has static SqlListRequestEvent in SqlListXElement class.
Here is an example:

Code:
            AddHandler(SqlListXElement.SqlListRequestEvent, new SqlListXElement.SqlListRequestEventHandler(queryPanel_SqlExecute));


    .   .   .   .   .   .   .   .   .   .

        private void queryPanel_SqlListRequest(object sender, SqlExecuteEventArgs e) {
            string sql = e.SQL;
            OleDbDataAdapter resultDA = new OleDbDataAdapter(sql, DbConnection);

            DataSet tempDS = new DataSet();
            try {
                resultDA.Fill(tempDS, "Result");

                StringWriter strWriter = new StringWriter();
                tempDS.WriteXml(strWriter);
                e.ListItems.LoadFromXml(strWriter.ToString());
            }
            catch (Exception) {
                e.ListItems.Clear();
            }
        }
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Korzh.com developer tools Forum Index -> EasyQuery WPF 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, 2005 phpBB Group