locked
Entity Framework - stored procedure mapping, excecuting SP with float parameters separated by commas RRS feed

  • Question

  • User-455533487 posted

    Hi.

    Im using Entity framework with POCO entity generator template + SQL Server. I have mapping to stored procedure that takes two floats as input.

    After executing function from code with two doubles as parameters: 1.23 and 4.56, SQL Profiler shows:

    exec storedProcedureName @arg1 = 1,23, @arg2= 4,56

    This is causing an error because it looks like that stored procedure takes 4 arguments, but it should take only two and there should be dots insted of commas in these floats.

    My SQL Server collation is SQL_Latin1_General_CP1_CI_AS. I tried to set:

               Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
               Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

    in DataContext Constructor, and directly before ExecuteFunction<>(..) of Entity Framework DataContext object, both with no result.

    Im confused, please give me some advice.

    Monday, September 27, 2010 12:27 PM

Answers

  • User1888586051 posted

    The POCO templates aren't always correctly modeled to your EF. Have you tried it without the script generator?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 27, 2010 4:42 PM
  • User197322208 posted

    exec storedProcedureName @arg1 = 1,23, @arg2= 4,56

    What's your code to exec SP in EF ?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 27, 2010 4:43 PM
  • User-455533487 posted

    It turned out, that everything is wroking well.

    Floats in trace of SQL Profler were displayed with commas instead of dots, but execution on sql server was proper - it recognised floats.

    It was my mistake to blame EF execution of stored procedures or cluture of double to DB float conversion, thanks for trying to help.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 28, 2010 3:17 AM

All replies

  • User1888586051 posted

    The POCO templates aren't always correctly modeled to your EF. Have you tried it without the script generator?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 27, 2010 4:42 PM
  • User197322208 posted

    exec storedProcedureName @arg1 = 1,23, @arg2= 4,56

    What's your code to exec SP in EF ?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 27, 2010 4:43 PM
  • User-455533487 posted

    It turned out, that everything is wroking well.

    Floats in trace of SQL Profler were displayed with commas instead of dots, but execution on sql server was proper - it recognised floats.

    It was my mistake to blame EF execution of stored procedures or cluture of double to DB float conversion, thanks for trying to help.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 28, 2010 3:17 AM