none
Can't Set PK; Always Comes Through As NULL RRS feed

  • Question

  • Created a VS2010 EDM/WCF Data Services website using an Oracle DB. Can’t get a PK to flow through from test client app to DB (even applied Hotfix: http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=37957  ).  WCF Data Services always sets the PK to null.  It seems that the valued of “StoreGeneratedPattern” is being ignored.

    Client side code to set PK (lzRow.COMMODITYID):

            internal void Load_CommodityId(string wsName)
            {
                DataTable oTable = GetExcelWSData(wsName);
    
                DataRow dRow;
    
                for (int i = 0; i < oTable.Rows.Count; i++)
                {
                    dRow = oTable.Rows[i];
    
                    COMMODITYIDTABLE lzRow = new COMMODITYIDTABLE();
    
                    string testVal = lzRow.COMMODITYID.ToString();
    
                    lzRow.COMMODITYID = 1000;  
                    lzRow.COMMODITYTYPEID = Convert.ToDecimal(dRow["COMMODITYTYPEID"]);
                    lzRow.LOCATIONID = Convert.ToDecimal(dRow["LOCATIONID"]);
                    lzRow.PEAKPERIODID = Convert.ToInt32(dRow["PEAKPERIODID"]);
                    lzRow.DESCRIPTION = dRow["DESCRIPTION"].ToString();
                    lzRow.QUANTITYTYPEID = Convert.ToInt32(dRow["QUANTITYTYPEID"].ToString());
    
                    _LZData.AddObject("COMMODITYIDTABLEs", lzRow);
               
                }
    
                SaveData();
            }
    

    Thursday, June 21, 2012 2:55 PM

Answers

  • Never mind.  Operator Error.  It helps to be referencing the right “Service Reference” in the test app. 

    Retran

    • Marked as answer by Retran Friday, June 22, 2012 3:57 AM
    Friday, June 22, 2012 3:57 AM