OA attempting to pass primary key on an insert?

4 posts, 1 answers
  1. Jason
    Jason avatar
    13 posts
    Member since:
    Sep 2006

    Posted 29 May 2009 Link to this post

    Hello,

    I'm very new to OA but have gotten my project set up and and am attempting to insert some data.  In this example, I have a LICAccount table in my database with a LICAccountKey INT as the primary key.  I marked it as the primary key when generating the code and it did put the following in the generated code specifying the identity field:

     

    [Telerik.OpenAccess.Persistent(IdentityField = "lICAccountKey")]  
     

     

    I'm using stored procedures for inserts, updates, and deletes, and the generated code looks correct for the insert stored procedure, meaning it is not expecting an input parameter of LICAccountKey since this is handled by the database.

    In my code I create a new LICAccount object and populate all of the fields besides LICAccountKey with data, add it to the scope, and commit the transaction.  I receive the following exception:

    Telerik.OpenAccess.Exceptions.MetadataException was unhandled by user code
      Message="Interface for stored procedure 'sp_oa_ins__l_i_c_account' not sufficient to pass the value for oid column 'LICAccountKey' of table

    'LICAccount'."
      Source="Telerik.OpenAccess"
      CanRetry=true
      Column=0
      ColumnName="LICAccountKey"
      ErrorId=0
      IsWarning=false
      Line=0
      ProcedureName="'sp_oa_ins__l_i_c_account'"
      TableName="'LICAccount'"
      Usage="oid"
      StackTrace:
           at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
           at Telerik.OpenAccess.RT.ExceptionWrapper.Throw()
           at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x)
           at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.internalCommit(Boolean phase)
           at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.commit()
           at OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.commit()
           at Telerik.OpenAccess.RT.TransactionImpl.Commit()
           at LIC_Business.LICUserManager.Save() in E:\LIC\WebSite\LIC\LIC Business\LICUserManager.cs:line 216
           at LIC_Website.WebForm2.CreateUserWizard1_CreatedUser(Object sender, EventArgs e) in E:\LIC\WebSite\LIC\LIC

    Website\CreateNewUser.aspx.cs:line 53
           at System.Web.UI.WebControls.CreateUserWizard.OnCreatedUser(EventArgs e)
           at System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser()
           at System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e)
           at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e)
           at System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e)
           at System.Web.UI.WebControls.Wizard.WizardChildTable.OnBubbleEvent(Object source, EventArgs args)
           at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
           at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
           at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
           at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
           at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
           at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
           at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      InnerException:

    It looks to me like OA is attempting to pass LICAccountKey to the stored procedure for an insert, but the stored procedure (correctly) doesn't have that as an input parameter.  Can anyone please help me understand why OA is not recognizing the identity field?

    Thanks,
    Jason

  2. Answer
    Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 30 May 2009 Link to this post

    Hello Jason,

    It seems that was a bug in or Q1 release. We had one similar case and upgrading to a newer version solved the problem. Please try the latest internal build with version 2009.01.0520.1, it should be available for download in your account.

    Greetings,
    Alexander
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Jason
    Jason avatar
    13 posts
    Member since:
    Sep 2006

    Posted 30 May 2009 Link to this post

    Thanks.  Will I have to start from scratch with rerunning the Reverse Engineering wizard in a new project, or can I just swap out the dll?

    Thanks,
    Jason
  5. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 01 Jun 2009 Link to this post

    Hello Jason,

    Yes, I think changing the reference/dll to the newer version should be enough.

    All the best,
    Alexander
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top