Don't miss out Virtual Happy Hour today (April 26).

Try our conversational search powered by Generative AI!

Error on IPriceDetailValue.Save Function

Vote:
 

We are tying to get the catalog pricing into the system but get the following exception when .save function is called. 

Here is the code. 

var priceDetailService = ServiceLocator.Current.GetInstance<IPriceDetailService>();
            var priceDetailValue = new PriceDetailValue
            {
                CatalogKey = new CatalogKey(CatalogContext.Current.GetCatalogEntry("127-BAM-SCRB")),
                MarketId = new MarketId("Default Market"), //????
                CustomerPricing = CustomerPricing.AllCustomers ,
                ValidFrom = DateTime.Today,
                ValidUntil = DateTime.Today.AddDays(4),
                MinQuantity = 1m,
                UnitPrice = new Money(100m, Currency.USD), PriceValueId=-1 
            };
      

            IPriceDetailValue value = priceDetailService.Save(priceDetailValue);

Any help would be appreciated... 

{System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated.
The data for table-valued parameter "@priceValues" doesn't conform to the table type of the parameter.
The statement has been terminated.11
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 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, TaskCompletionSource`1 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.ExecuteReader()
at Mediachase.Commerce.Pricing.Database.PriceDetailDatabase.SaveWorker(DataTable priceTable)
at Mediachase.Commerce.Pricing.Database.PriceDetailDatabase.Save(IEnumerable`1 priceValues)
at Mediachase.Commerce.Pricing.PriceDetailExtensions.Save(IPriceDetailService service, IPriceDetailValue priceValue)
at Whereoware.ProductFeed.Program.EPITest() in c:\tfs\EPI Server\WOWProductFeed7.5.0.0\WOWProductFeed7.5.0.0\Program.cs:line 89
at Whereoware.ProductFeed.Program.Main() in c:\tfs\EPI Server\WOWProductFeed7.5.0.0\WOWProductFeed7.5.0.0\Program.cs:line 62
ClientConnectionId:6844b58c-147f-4e35-b966-09ccd904f0cc}

#87337
Jun 10, 2014 21:10
Vote:
 

Nevermind, The problem was in market id. I was providing long string in the market id entry. 

#87338
Jun 10, 2014 21:27
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.