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