tags:

views:

8

answers:

0

I have the following BDC method to insert new spending plans. I'm trying to return the last insert primary key so I can reference it in another table. Does anyone know how to return the last primary key inserted using the BDC? I know how to do it in SQL, but I can't see to figure out how to do it through SharePoint.

    <Method Name="InsertSpendPlan">
      <Properties>
        <Property Name="RdbCommandText" Type="System.String">Insert into dbo.Program_Spend_Plan([PROGRAM_ID],[FY_ID],[BUDGET])
        Values(@PROGRAM_ID,@FY_ID,@BUDGET);select SomethingToReturn = @@Identity</Property>
        <Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">Text</Property>
      </Properties>
      <Parameters>
        <Parameter Direction="In" Name="@PROGRAM_ID">
          <TypeDescriptor TypeName="System.Int32" Name="PROGRAM_ID" />
        </Parameter>
        <Parameter Direction="In" Name="@FY_ID">
          <TypeDescriptor TypeName="System.Int32" Name="FY_ID" />
        </Parameter>
        <Parameter Direction="In" Name="@BUDGET">
          <TypeDescriptor TypeName="System.String" Name="BUDGET" />
        </Parameter>
        <Parameter Direction="Return" Name="SpendPlan">
          <TypeDescriptor TypeName="System.String" Name="SomethingToReturn" />
        </Parameter>
      </Parameters>
      <MethodInstances>
        <MethodInstance Type="GenericInvoker" ReturnParameterName="SpendPlan" ReturnTypeDescriptorName="SomethingToReturn" ReturnTypeDescriptorLevel="0" Name="SpendPlanInserter" />
      </MethodInstances>
    </Method>