locked
ajax + data service insert failed RRS feed

  • Question

  • Hi,
    could you help me with my problem. I'm using entity framework and data service so I could insert some data to database from client side.

     
            <script language="javascript" type="text/javascript">
                function DodajStudentaUGrupu() {
                    var studenti = document.getElementById("ListBoxStudenti");
                    var studJMBAG;
                   
                    if (studenti != null) {
                        while (studenti.selectedIndex != -1) {
                           
                            if (studenti.selectedIndex != 0) {
                                studJMBAG = studenti.options[studenti.options.selectedIndex].value;
                                ds.insert({diskusijskaGrupa: { __metadata: { uri: 'diskusijskaGrupa(' + idDiskGrupe + ')'} }, student: { __metadata: { uri: "student/?$filter=JMBAG eq'" + studJMBAG + "'&$expand=osoba"}} }, "studentDiskusijskaGrupa", ADPopuniStudente, ADpGreska);
                                
                            }
                            studenti.options[studenti.selectedIndex].selected = false;
                        }
                }
           }
    This is my code and it doesn't work maybe 'couse my table student inherits table osoba.

    I have tables studentDiskusijskaGrupa, diskusijskaGrupa and student. I'm inserting in studentDiskusijskaGrupa where idDiskusijskaGrupa and JMBAG are foreign keys. So entity framework made them Navigation proporties. So I think that problem is that table student inherits table osoba on key JMBAG. So I've read that i should include that in uri. But I don't know how. I tried everything and nothing worked. Please help!!
    Tuesday, April 14, 2009 4:05 PM