从字符串"select DatePart(Year,onDate)来回"转换;输入"Double"无效. [英] Conversion from string "select DatePart(Year,onDate) fro" to type 'Double' is not valid.

查看:53
本文介绍了从字符串"select DatePart(Year,onDate)来回"转换;输入"Double"无效.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!!!!

我在运行项目时遇到此错误.

Hi all !!!

i am getting this error while running my project.

Conversion from string "select DatePart(Year,onDate) fro" to type ''Double'' is not valid.



这是代码



this is the code

Private Function GpfOpeaningYear() As String
       Dim id As Int64 = Convert.ToInt64(Request.QueryString("eid"))
       Dim SYear As String = Dal.ExScalar("select DatePart(Year,onDate) from GPF_OP_Bal where empid=" + id + " ")
       Return SYear
   End Function




在sql-server中运行时,sql查询工作正常.它给出了2008年的答案.我无法找到解决方案.几乎不需要帮助...




the sql query works fine when run in sql-server . It gives 2008 as answer. I am unable to find the solution for this. Little help is needed...

推荐答案

您正在向INT64添加字符串.顺便说一下,它的值为32.
永需要一个字符串.
试试:
You''re adding a string to an INT64. Its value is 32, by the way.
Yon need a string.
Try:
Dim SYear As String = Dal.ExScalar("select DatePart(Year,onDate) from GPF_OP_Bal where empid=" + id.ToString() + " ")



希望这会有所帮助,
巴勃罗



Hope this helps,
Pablo


这篇关于从字符串"select DatePart(Year,onDate)来回"转换;输入"Double"无效.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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