Developer forum

Forum » Development » Gui.DropDownList()

Gui.DropDownList()


Reply

 

Hello DW,

 

 

After DW's latest updates, i have noticed that we can't use anymore Gui.DropDownList() for tables that contains only one column.
For example we have such code:
        Gui.DropdownList("sort1","Billetnet.mdb","Tabel1","Kunstner","Kunstner",prop.get_getValue("sort1"))
DropDownList method generate query:
        SELECT Kunstner, Kunstner FROM Tabel1 ORDER BY Kunstner
In this case we have SQL error: 
    Ambiguous column name ‘Kunstner’.
Also we can’t specify column name like [TableName].[ColumnName], because in this case SQLReader will not contain value by [TableName].[ColumnName] key (because key will be just [ColumnName]). For this reason we also can’t use “as” keyword.
 
I have solution option.
Gui.DropDownList method. Line 3. In this code line we can directly specify table name for “order by” sentence:
Current  line:
    IDataReader reader = Database.getDataReader("SELECT " + ValueField + ", " + TextField + " FROM " + Table + " ORDER BY " + TextField + " ", Database);
Proposed line:
    IDataReader reader = Database.getDataReader("SELECT " + ValueField + ", " + TextField + " FROM " + Table + " ORDER BY " + Table + “.” + TextField + " ", Database);
 
This solution not affect other cases, and allow to use Gui.DropDownList() for tables that contains only one column.


Any suggestion?

 

Best regards

Buba


Replies

 
Reply

It looks lige something we should fix in the control. Can you hack it by using something like this:

 Gui.DropdownList("sort1","Billetnet.mdb","Tabel1","Kunstner as K1","Kunstner",prop.get_getValue("sort1"))

 

 
Reply
Sorensen wrote:

It looks lige something we should fix in the control. Can you hack it by using something like this:

 Gui.DropdownList("sort1","Billetnet.mdb","Tabel1","Kunstner as K1","Kunstner",prop.get_getValue("sort1"))

 

 

 

 

Hi Lars,

 

We have tried ,ti can't use this hack, because when we get value from reader (reader["Kunstner as K1"]) it will be null.

 

 

 

By the same problem we can't even use he following:

 

Gui.DropdownList("sort1","Billetnet.mdb","Tabel1","Tabel1.Kunstner","Kunstner",prop.get_getValue("sort1"))

 
Reply

Oh, sorry, I misunderstood what you wrote earlier. Then I'm out of ideas besides using a different control until we make an improved version of this one.

 

You must be logged in to post in the forum