本文介绍了请帮帮我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好。 下面是我的C#代码,我使用一些离线工具从VB翻译,但我面临'DateDiff'上下文错误 以下是我的C#代码 if (dateok& timeok) { System.DateTime thislesson_datetime = default ( System.DateTime的); if (!string.IsNullOrEmpty(Request [ form_lesson_time $ form_dropdown__Hour])) { thislesson_datetime = Convert.ToDateTime(Request [ form_lesson_date] + + Request [ form_lesson_time $ form_dropdown__Hour] + : + Request [ form_lesson_time $ form_dropdown__Minute] + +请求[ form_lesson_time $ form_dropdown__AMPM]); } else { thislesson_datetime = Convert.ToDateTime(Request [ form_lesson_date] + + Request [ form_lesson_time]); } if (DateDiff(DateInterval.Hour,thislesson_datetime,fixed_Now)> 0 & String .Len( String .Trim(Request [ form_lesson_notes])) < 50 ) { errors + = 请输入详细的课程笔记。; } } 错误: if(DateDiff(DateInterval.Hour,thislesson_datetime,fixed_Now)> 0& String.Len(String.Trim(Request [form_lesson_notes]))< 50)错误名称:名称'DateDiff'确实在当前上下文中不存在。 你们都被请求帮我排序这个错误解决方案 form_dropdown__Hour ])) { thislesson_datetime = Convert.ToDateTime(Request [ form_lesson_date ] + + Request [ form_lesson_time form_dropdown__Hour] + : + Request [ form_lesson_time form_dropdown __Minute] + + Request [ form_lesson_time Hello allBelow is my C# code which I translate from VB using some one offline tool but am facing an 'DateDiff' Context error in itBelow is my C# codeif (dateok & timeok){System.DateTime thislesson_datetime = default(System.DateTime);if (!string.IsNullOrEmpty(Request["form_lesson_time$form_dropdown__Hour"])){thislesson_datetime = Convert.ToDateTime(Request["form_lesson_date"] + " " + Request["form_lesson_time$form_dropdown__Hour"] + ":" + Request["form_lesson_time$form_dropdown__Minute"] + " " + Request["form_lesson_time$form_dropdown__AMPM"]);}else{thislesson_datetime = Convert.ToDateTime(Request["form_lesson_date"] + " " + Request["form_lesson_time"]);}if (DateDiff(DateInterval.Hour, thislesson_datetime, fixed_Now) > 0 & String.Len(String.Trim(Request["form_lesson_notes"])) < 50){errors += "Please enter detailed lesson notes.";}}Error:if (DateDiff(DateInterval.Hour, thislesson_datetime, fixed_Now) > 0 & String.Len(String.Trim(Request["form_lesson_notes"])) < 50)Error Name: The name 'DateDiff' Does not exist in current context.You all are requested to help me sort this error 解决方案 form_dropdown__Hour"])){thislesson_datetime = Convert.ToDateTime(Request["form_lesson_date"] + " " + Request["form_lesson_timeform_dropdown__Hour"] + ":" + Request["form_lesson_timeform_dropdown__Minute"] + " " + Request["form_lesson_time 这篇关于请帮帮我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 22:25