从system.double到system.byte[]的转换无效,该怎么解决
从system.double到system.byte[]的转换无效
我的程序里有这么一句:
dim dr as oledb.oledbdatareader
oledbcommand4.commandtext= "select endtime-starttime as timelong from table where id in @id " '不是一样的,但就是这个意思
oledbcommand4.connection.open()
dr=oledbcommand4.excutereader
datagrid1.datasource=dr
datagrid1.databind()
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
运行时提示 从system.double到system.byte[]的转换无效,
什么意思啊?如何解决??谢谢!!
------解决方案--------------------
看看datagrid1有没有绑定字段?如果有字段的类型是什么?可能是系统自动强制转换出问题了
------解决方案--------------------
只从上面的代码应该看不出哪里错了,
不过你可能是你的DataGrid上的数据格式设置有问题.
------解决方案--------------------
小的能往大的转,但是大的不能往小的转。
------解决方案--------------------
你数据库中的id 是什么类型的,你传进来的参数@id又是什么类型的,什么样的数据
------解决方案--------------------
怀疑是@id的类型错误!
------解决方案--------------------
oledbcommand4.commandtext= "select endtime-starttime as timelong from table where id in @id "
你这查询语句有问题吧。。。。
应该:
"select [endtime-starttime] as timelong from table where id in @id "
------解决方案--------------------
SELECT 语句 IN 后面是应该有()的
oledbcommand4.commandtext= "select endtime-starttime as timelong from table where id in (11213,11215,11217)
------解决方案--------------------
前台用DataBind
<%# %>
------解决方案--------------------
oledbcommand4.commandtext= "select endtime-starttime as timelong from table where id in (@id) "
dim p1 as oledb.oledbparameter
p1=new oledb.oledbparameter( "@id ",oledb.oledbtype.varchar)
p1.value=string.Join( ", ",new string() {11213,11215,11217})
oledbcommand4.parameters.add(p1)
我的程序里有这么一句:
dim dr as oledb.oledbdatareader
oledbcommand4.commandtext= "select endtime-starttime as timelong from table where id in @id " '不是一样的,但就是这个意思
oledbcommand4.connection.open()
dr=oledbcommand4.excutereader
datagrid1.datasource=dr
datagrid1.databind()
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
运行时提示 从system.double到system.byte[]的转换无效,
什么意思啊?如何解决??谢谢!!
------解决方案--------------------
看看datagrid1有没有绑定字段?如果有字段的类型是什么?可能是系统自动强制转换出问题了
------解决方案--------------------
只从上面的代码应该看不出哪里错了,
不过你可能是你的DataGrid上的数据格式设置有问题.
------解决方案--------------------
小的能往大的转,但是大的不能往小的转。
------解决方案--------------------
你数据库中的id 是什么类型的,你传进来的参数@id又是什么类型的,什么样的数据
------解决方案--------------------
怀疑是@id的类型错误!
------解决方案--------------------
oledbcommand4.commandtext= "select endtime-starttime as timelong from table where id in @id "
你这查询语句有问题吧。。。。
应该:
"select [endtime-starttime] as timelong from table where id in @id "
------解决方案--------------------
SELECT 语句 IN 后面是应该有()的
oledbcommand4.commandtext= "select endtime-starttime as timelong from table where id in (11213,11215,11217)
------解决方案--------------------
前台用DataBind
<%# %>
------解决方案--------------------
oledbcommand4.commandtext= "select endtime-starttime as timelong from table where id in (@id) "
dim p1 as oledb.oledbparameter
p1=new oledb.oledbparameter( "@id ",oledb.oledbtype.varchar)
p1.value=string.Join( ", ",new string() {11213,11215,11217})
oledbcommand4.parameters.add(p1)