指定的演员表在Linq中无效? [英] Specified cast is not valid in Linq?

查看:82
本文介绍了指定的演员表在Linq中无效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些是数据库结构

TimeSheetId    int             未选中
ReserveID     int            未选中
LoginTime      日期时间  已检查
登出时间  日期时间 已检查
日                  nbsp; bsp    已检查
小时                  nbsp; bsp   未选中
      

首先我正常绑定,正确地工作

但是我像这样制定小时字段

(CONVERT([nvarchar](52),[LogoutTime]-[LoginTime],(108)))

出现错误:

解决方案

您是否要查询SQL select语句?您可以显示完整的语句和小时"列的域吗?什么是已检查/未检查"?是什么意思?

如果这是有关SQL的问题,那么,也许SQL论坛可能会提供更好的质量答案?

如果这不是SQL问题,那么您能否提供更多解释?通过数据库结构"来表示.您是说表格"吗? 首先我正常地绑定". -将什么绑定到什么? 转换"据我所知,它不是C#关键字,.Net中有一个 转换类,但我认为它没有一个看起来像这样的构造函数(它甚至不是有效的C#语法)基本上...是吧?


Hi,

these is Database Structure

TimeSheetId    int               Unchecked
ReserveID        int               Unchecked
LoginTime        datetime      Checked
LogoutTime      datetime     Checked
Day                                     Checked
Hour                                   Unchecked
       

first i bind normally , its work properlly

but i formulate Hour Field like

(CONVERT([nvarchar](52),[LogoutTime]-[LoginTime],(108)))

its giving a error :

Specified cast is not valid.]

while i refresh the table from server explorer and again drag and drop it

thanks

解决方案

Are you asking about an SQL select statement?  Can you show the full statement and the domain of the Hour column?  What does "Checked/Unchecked" mean?

If this is a question about SQL then, perhaps, an SQL forum may give better quality answers?

If it is not an SQL question then can you give some more explanation?  By "Database structure" do you mean "table"?  "first I bind normally" - what is being bound to what?  "CONVERT" is not a C# keyword as far as I know, in .Net there is a Convert class but I don't think it has a constructor that looks like that (it is not even valid C# syntax)  Basically ... huh?


这篇关于指定的演员表在Linq中无效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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