exec sp_executesql N'insert [dbo].[Clients]([client_no], [client_name], [Address], [Contact1], [C1_Email], [C1_Phone], [C1_Ext], [Contact2], [C2_Email], [C2_Phone], [C2_Ext], [EnteredBy], [ModifiedBy], [EnteredOn], [ModifiedOn]) values (@0, @1, @2, @3, @4, @5, null, null, null, null, null, @6, null, @7, null) select [ClientId] from [dbo].[Clients] where @@ROWCOUNT > 0 and [ClientId] = scope_identity()', N'@0 smallint,@1 varchar(30),@2 varchar(max) ,@3 varchar(100),@4 varchar(100),@5 varchar(max) ,@6 char(6),@7 datetime2(7)',@0=789,@1='Naomi',@2='Test',@3='Naomi',@4='test@microsoft.com',@5='(817) 780-9054',@6='ADMIN ',@7='2013-04-15 13:47:46.3899786'where I suspect the error comes from the date column (EnteredOn) which I update manually this way:
public void AddClient(Client client, bool autoCommit = true) { client.EnteredOn = DateTime.Now; this.context.Clients.Add(client) ; context.Entry(client).Property(u => u.ModifiedBy).IsModified = false; context.Entry(client).Property(u => u.ModifiedOn).IsModified = false; client.EnteredBy = "ADMIN"; //constant for now if (autoCommit) this.Commit(); }UPDATE. The error is actually for the Phone column. In my table I believe I assume the column is supposed to be saved without mask characters. I am wondering what is the best way to ensure that?