请帮我检索错误 [英] Please help me to Retrieve error

查看:63
本文介绍了请帮我检索错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试计算一名员工的工作时数......请帮我从这个错误中检索:( :( :(



以下代码我用....

 DateTime inTime =会话[  time]; 
DateTime outTime = DateTime.Now; // 或获取你的从你的逻辑出来的时间
TimeSpan span = outTime.Subtract(inTime);
TextBox1.Text = span.Seconds.ToString();



描述:编译服务此请求所需的资源时出错。请查看以下具体错误详情并适当修改源代码。



编译器错误消息:CS0266:无法将类型''object''隐式转换为''System.DateTime''。存在显式转换(你是否缺少一个演员?)

解决方案

倍pan span = outTime - inTime;


编译器错误消息:CS0266:无法将类型''object'隐式转换为''System.DateTime''。存在显式转换(您是否错过了演员?)。

阅读您的例外:



DateTime inTime =(DateTime)Session [时间];



您应该检查会话是否为空。


I Am trying to calculate number of working hours of an employee... Please Help me to retrieve from this error :( :( :(

Following code i used....

DateTime inTime = Session["time"];
DateTime outTime = DateTime.Now;//or Get ur out time from ur logic
TimeSpan span = outTime.Subtract(inTime);
TextBox1.Text = span.Seconds.ToString();


Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0266: Cannot implicitly convert type ''object'' to ''System.DateTime''. An explicit conversion exists (are you missing a cast?)

解决方案

TimeSpan span = outTime - inTime;


Compiler Error Message: CS0266: Cannot implicitly convert type ''object'' to ''System.DateTime''. An explicit conversion exists (are you missing a cast?) .
Read your Exception:

DateTime inTime = (DateTime) Session["time"];

And you should check if the Session is null.


这篇关于请帮我检索错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆