I've got this classes:
UserServices:
UserRepository usrrep=new UserRepository();
public Object[] listaFeedbackUtilizatori()
{
return usrrep.listaFeedbackUtilizatori();
}
UserRepository:
public Object[] listaFeedbackUtilizatori()
{
DataTable dt = new DataTable();
dt.Columns.Add("IdFeedback", typeof(int));
dt.Columns.Add("Username", typeof(string));
dt.Columns.Add("DataFaeedback",typeof(DateTime));
dt.Columns.Add("TextFeedback", typeof(string));
var query = from utilizator in net.utilizator
join feedback in net.feedback
on utilizator.idutilizator equals feedback.idutilizator
select dt.LoadDataRow(
new object[] { feedback.idfeedback,utilizator.username, feedback.data, feedback.text },
false);
Object []o = new Object[100];
DataTable d = new DataTable();
try
{
d = query.CopyToDataTable();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
return o;
}
And class:
AdministrareRetele
private void AdministrareBazadeDate_Load(object sender, EventArgs e)
{
o = usrsrv.listaFeedbackUtilizatori();
comboBox1.DataSource = listarticol;
comboBox1.DisplayMember = "nume_articol";
comboBox1.ValueMember = "nume_articol";
comboBox4.DataSource = o;
comboBox4.DisplayMember = "username";
comboBox4.ValueMember = "username";
}
In my database (mysql) I have this table:
Feedback:
idfeedback (int)
iduser (int)
date (datetime)
text (varchar)
and a foreign key which connects to another table USER through iduser
And in form a combobox:
http://img854.imageshack.us/img854/3994/45618197.png[
^][
]
I just want to populate my combobox4 option list with values containing USERNAMES
I tried like in the code above , but It gives me an error:
"LINQ to Entities does not recognize the method 'LoadDataRow' method, and this method cannot be translated into a store expression"
Any help, or idea will be highly appreciated