我使用LINQ
從分鐘(75)中的數據庫中獲取值。現在我想使用LINQ
將此分鐘轉換爲HH MM SS格式。誰能幫幫我嗎。在linq中顯示HH MM SS格式的分鐘數
謝謝。 我試着用下面的代碼,但是我沒有成功。
TimeSpan tsMinutes;
try
{
using (VodafoneDataClassesDataContext vodafoneDataClassesDataContext = new VodafoneDataClassesDataContext())
{
vodafoneDataClassesDataContext.Connection.ConnectionString = BECommon.VodafoneConnectionString;
return (from auditFormsFilledMasters in vodafoneDataClassesDataContext.AuditFormsFilledMasters
join storeMasters in vodafoneDataClassesDataContext.StoreMasters
on auditFormsFilledMasters.StoreId equals storeMasters.Id
join deskMasters in vodafoneDataClassesDataContext.DeskMasters
on auditFormsFilledMasters.DeskId equals deskMasters.Id
join usersMasters in vodafoneDataClassesDataContext.UserMasters
on auditFormsFilledMasters.AuditorId equals usersMasters.Id into tempMaster
from TempCircleStore in tempMaster.DefaultIfEmpty()
where auditFormsFilledMasters.StoreId == fieldStoreId
select new BEAuditFormsFilledMaster
{
minutesSpan = new TimeSpan(0, Convert.ToInt32(auditFormsFilledMasters.LengthofRecordinMin.ToString()), 0),
tsMinutes = new TimeSpan(0, Convert.ToInt32(auditFormsFilledMasters.LengthofRecordinMin.ToString()), 0),
LengthofConversation = auditFormsFilledMasters.LengthofRecordinMin.ToString(),
where auditFormsFilledValues.AuditFormsFilledMasterId == auditFormsFilledMasters.Id
select auditFormsFilledValues.SelectedScore).Sum(),
}).ToList<BEAuditFormsFilledMaster>().AsReadOnly();
}
該代碼的絕大部分似乎無關你的問題..哪裏是你的DateTime對象? – Sayse
@Sayse他想要一個TimeSpan。 –
啊好的...我仍然很難找出問題的出在哪裏,我推測tsMinutes,但從來沒有可以肯定 – Sayse