Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Thomas 151 posts 326 karma points
    Jun 02, 2015 @ 09:54
    Thomas
    0

    Error on executing SP in Production Environment

    Hi, I am trying to execute the following part of code in production environment

    using (var db = ApplicationContext.Current.DatabaseContext.Database)
                {
                    db.CommandTimeout = 200;
    
                    var hotelGenDataResults = db.Fetch<Hotel_GeneralData>(";EXEC [dbo].[GetBookingHotelGeneralData] @hotelId, @languageCode", new { hotelId = providerHotel.hotel_id, languageCode = locale.ToLower() });
                    if (hotelGenDataResults != null && hotelGenDataResults.Any())
                    {
                        providerHotel.Hotel_GeneralData = hotelGenDataResults.ToList().FirstOrDefault();
                    }
    
                    var hotelPhotosResult = db.Fetch<Hotel_Photos>(";EXEC [dbo].[GetBookingHotelAndRoomsPhotos] @hotelId", new { hotelId = providerHotel.hotel_id });
                    if (hotelPhotosResult != null && hotelPhotosResult.Any())
                    {
                        providerHotel.Hotel_Photos = hotelPhotosResult.ToList();
                    }
    
                    var hotelFacilitiesResult = db.Fetch<Hotel_Facilities>(";EXEC [dbo].[GetBookingHotelFacilities] @hotelId, @languageCode", new { hotelId = providerHotel.hotel_id, languageCode = locale.ToLower() });
                    if (hotelFacilitiesResult != null && hotelFacilitiesResult.Any())
                    {
                        providerHotel.Hotel_Facilities = hotelFacilitiesResult.ToList();
                    }
                }
    

    and i am getting the following error

    2015-06-02 10:38:18,142 [57] INFO Umbraco.Core.Persistence.UmbracoDatabase - [Thread 32] at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteDbDataReader(CommandBehavior behavior) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 248 at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() at Umbraco.Core.Persistence.Database.<Query>d__71.MoveNext()

    On development environment it works perfect. Any suggestions please?

    Thomas

  • Thomas 151 posts 326 karma points
    Jun 02, 2015 @ 12:11
    Thomas
    100

    Fixed, the problem was with a DateTime conversion and not with the SP execution.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies