I am using Flex to insert data through remoteobject and using
SAVE method generated from CFC Wizard.
My VO contains the following variables where id has a default
value of 0 :
public var id:Number = 0 ;
public var date:String = "";
public var accountno:String = "";
public var debit:Number = 0;
public var credit:Number = 0;
id is set as the primary key in my database.
I have previously used MySQL which automatically generates a
new id if I either omitted the id value in my insert statement or
use 0 as the default value.
However, now I am using MS SQL Server and the insert
generated this error:
Unable to invoke CFC - Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert
explicit value for identity column in table 'Transactions' when
IDENTITY_INSERT is set to OFF.
Strange thing is that I dont see this problem with another
sample application. I compared with that application (it has the
same VO with default value of 0 for id) and everything looks
similar so I can't understand why I have this error in my
This is SQL used to create the table:
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON