I am using a framework in my application to insert data in a table which has identity insert enabled with the identity column being the primary key.
IN profiler I see that the query is being fired from the application.
exec sp_executesql N'insert [dbo].[tblCommissionsManualInput]([VendorPayID], [DealerNumber], [NSCC_CODE], [RepID], [CUSIP], [SHLDRALPHA], [TradeDate], [AmountInvested], [DealerCommission], [AccountNumber], [SocialSecurityNumber], [BatchDate], [IncludedInCommission], [CreateDate], [EnteredBy], [InvestmentName], [AmountReceived], [TransDate], [SourceRepCode], [SourceRepName], [CommissionTypeId], [TicketCharge], [CommissionFee]) values (@0, @1, null, @2, @3, @4, @5, @6, @7, @8, null, @9, @10, @11, null, @12, @13, @14, @15, @16, @17, null, null) select [tblCommissionsManualInputID] from [dbo].[tblCommissionsManualInput] where @@ROWCOUNT > 0 and [tblCommissionsManualInputID] = scope_identity()',N'@0 bigint,@1 nvarchar(50),@2 int,@3 nvarchar(9),@4 nvarchar(200),@5 datetime2(7),@6 decimal(18,2),@7 decimal(18,2),@8 nvarchar(20),@9 datetime2(7),@10 bit,@11 datetime2(7),@12 nvarchar(200),@13 decimal(18,2),@14 datetime2(7),@15 nvarchar(50),@16 nvarchar(150),@17 bigint',@0=11466,@1=N'13W',@2=0,@3=N'63009F105',@4=N'Boosalis W',@5='2013-06-03 00:00:00',@6=4178.90,@7=21.00,@8=N'154913629',@9='1899-01-01 00:00:00',@10=1,@11='2013-06-25 00:38:28.5414597',@12=N'NANOSPHERE INC',@13=4178.90,@14='2013-06-03 00:00:00',@15=N'263092',@16=N'',@17=2 go
But, there is no row inserted in the table.
Also, I see that this query actually returns a number which doesn't even exist as the identity number in the table. So my framework thinks that the row is inserted, when in turns it's not.
Please let me know what is wrong here.
suneeelid2000@gmail.com