if (topicTexts != null) { TopicTextDataMapper oTopicTextDataMapper = new TopicTextDataMapper(oDb); TopicDataMapper oTopicDataMapper = new TopicDataMapper(oDb); List topics; Weborb.Data.Management.QueryResult qeuryResult; foreach (TopicText oTopicText in topicTexts) { qeuryResult = oTopicDataMapper.findBySql("select * from topic where EngineID = " + oTopicText.RelatedTopic.EngineID); topics = (List)qeuryResult.Result; if (topics.Count > 0) { oTopicText.RelatedTopic = topics[0]; oTopicText.RelatedText = oText; oTopicTextDataMapper.create(oTopicText); } } }