I have silverlight 4 app. host ASP.NET web app. enabled WCF RIA services. From sever side apach2 php5 Mysql. With MySql connector, ADO.NET Entity Data Model, Domain Service class I have access to MySql database. Work fine... (for me slowly, but WORK).
table:
languages
LANG_ID char(10)
LANG_NAME char(40)
LANG_NAME_SHORT char(10)
LANG_IMAGE blob
LANG_PATH char(100)
DEFAULT char(1)
STATUS_ID char(1)
xaml:
<ComboBox x:Name="Language_Choice" Height="25" Width="110">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding LANG_PATH}" Width="16" Height="16"></Image>
<TextBlock Text="{Binding LANG_NAME_SHORT}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
Code:
DataDomainContext _context = new DataDomainContext();
EntityQuery<languages> _query = from _l in _context.GetLanguagesQuery()
where _l.STATUS_ID == "Y"
orderby _l.LANG_NAME_SHORT
select _l;
LoadOperation<languages> _loadOp = _context.Load(_query);
Language_Choice.ItemsSource = _loadOp.Entities;
Question: I want result query put into List:
public class LangChoice
{
public string LangID { get; set; }
public string LangName { get; set; }
public byte LangImg { get; set; }
public string LangPath { get; set; }
public string LangDef { get; set; }
} List<LangChoice> LangList = new List<LangChoice>();
Is there any way to put result to list and save list item index where languages.DEFAULT == "Y". Without list I don't know defined Language_Choice.SelectedIndex=0;(error=out of range) in xaml or code.
I'm new "developer". Is I write a code generic SELECT like: "SELECT fild1, fild2 FROM table WHERE field_900="HELP" ..." I don't wont result all field from table, only defined. Environment (c# Silverlight, Apach, PHP, MySql with WCF RIA Services)
Forwards Thanks