Base solution for your next web application
Open Closed

Insert in DB problems #673

aranhico created

Hello, I'm facing a problem. I'm trying to insert a bunch of entities into database but I can't, and EF doesn't raise any exception neither ABP. ( I checked the logs and nothing). Im uploading a pdf (in a controller) who calls an app service, reads the pdf and starts inserting in the database (please advise me on better aproaches or best practices). One strange thing is in SQL PROFILER, i see the INSERT statements but the decimals values have a comma instead of a dot

806,@5=162170,@6=0,@7=0,@8=N'149996',@9=N'2004/01/29 ',@10=N'148235 ',@11='2005-02-18 00:00:00',@12=0,@13=79780,@14=600,@15=142,05000000000001,@16=1,1232

but it should be

806,@5=162170,@6=0,@7=0,@8=N'149996',@9=N'2004/01/29 ',@10=N'148235 ',@11='2005-02-18 00:00:00',@12=0,@13=79780,@14=600,@15=**142.05000000000001**,@16=**1.1232**

my culture is portuguese, where a comma is the decimal sepparator (I changed the Application_BeginRequest in global.asax the thread to portuguese and nothing changed) anyway, an exception should be raised, right? thank you

3 Answer(s)
  • 0
    hikalkan created
    Support Team

    It should be in logs normally, did not understand why not logged. You can try to change culture to english before saving entity, as a workaround. But, your case is a general problem related to EF. If you find a solution, please share with us. Thanks.

  • 0
    aranhico created

    tried your tip but didn't work.

    exec sp_executesql N'INSERT [dbo].[Imovel]([Id], [TenantId], [PortfolioId], [IsDeleted], [DeleterUserId], [DeletionTime], [LastModificationTime], [LastModifierUserId], [CreationTime], [CreatorUserId])
    VALUES (@0, @1, @2, @3, NULL, NULL, NULL, NULL, @4, @5)
    ',N'@0 nvarchar(128),@1 int,@2 int,@3 bit,@4 datetime2(7),@5 bigint',@0=N'6',@1=1,@2=2,@3=0,@4='2016-01-14 20:34:49.4314465',@5=2

    I copied this from sql profiler and tried to execute it in sql server and it takes ages....sometimes works sometimes doesn't. any ideia?

  • 0
    aranhico created

    forgot to let you know: I changed the sql server collation to "SQL_Latin1_General_CP1_CI_AI" and now everything is ok

    <a class="postlink" href=""></a>

    thank you