Click here to Skip to main content
15,743,541 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
string loadHistoryID = CommonGet.GetDataRunHistoryID(Convert.ToInt32(sourceDefinitionId), item.FileName);
                xmlRecordList.Add(new StagingXML { CreateDateTime = DateTime.Now, CreateUser = "DataLoad", Data = item.XMLData, StagingLoadHistoryId = Convert.ToInt32(loadHistoryID), StagingRecordId = 1 });
Thomas Daniels 8-Jan-16 10:35am    
What is the exact content of sourceDefinitionId and loadHistoryID?
raxhemanth 8-Jan-16 10:38am    
string sourceDefinitionId = (from x in NgDb.StagingSourceDefinitions
where x.Name == DataFeed.SandozHibbertInboundDataFeed.Ids.DataFeedName && x.IsActive == true
select x.Id).Single().ToString();

string loadHistoryID = CommonGet.GetDataRunHistoryID(Convert.ToInt32(sourceDefinitionId), item.FileName);

please check
F-ES Sitecore 8-Jan-16 10:41am    
That's not what was asked, how do we know what is in loadHistoryID when we can't access your data or run your code? As said by others, loadHistoryID will be something you can't convert to an int, we don't know what it is and it seems you don't either. You should learn to use the debugger to step through your code and examine variables and the root of these problems will become clearer. Debugging is a vital skill, as often (like this) there are problems that only you can solve.

1 solution

Either your sourceDefinitionId or your loadHistoryID is not a valid string representation of an integer - so use the debugger and find out which. When you know what is in it, you can start looking at why, and work out what type of conversion you need.

We can't do that - we can't run your code in isolation!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900