This is a migrated thread and some comments may be shown as answers.

OA attempting to pass primary key on an insert?

3 Answers 64 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jason
Top achievements
Rank 1
Jason asked on 29 May 2009, 04:34 PM

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

3 Answers, 1 is accepted

Sort by
0
Accepted
Alexander
Telerik team
answered on 30 May 2009, 02:38 PM
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.
0
Jason
Top achievements
Rank 1
answered on 30 May 2009, 08:12 PM
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
0
Alexander
Telerik team
answered on 01 Jun 2009, 07:04 AM
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.
Tags
Development (API, general questions)
Asked by
Jason
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Jason
Top achievements
Rank 1
Share this question
or