| View previous topic :: View next topic |
| Author |
Message |
Abiss Novice
Joined: 09 Nov 2011 Posts: 3
|
Posted: Fri Jul 06, 2012 3:47 pm Post subject: SQL List in DME and distinct list of values in Query Panel |
|
|
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 |
|
 |
Admin Site Admin
Joined: 07 Nov 2005 Posts: 272
|
Posted: Tue Aug 21, 2012 4:32 pm Post subject: |
|
|
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 |
|
 |
|