Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I've got this classes:

UserServices:
C#
UserRepository usrrep=new UserRepository();
 public Object[] listaFeedbackUtilizatori()
        {
            return usrrep.listaFeedbackUtilizatori();
        }




UserRepository:

C#
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
C#
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
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900