本文介绍了VB.NET错误:操作数类型冲突:日期与int不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在尝试使用where子句从数据库中显示名为staffpresentee的表中的记录... i am using visual studio 2010 ... 表设计如下 -       fieldname       ;            数据类型          允许为空 1     staff_id(FK)              数字(18,0)        是 2      日期       &NBSP ;                   日期     &NBSP ;           no 3   &nbs磷;本                       焦炭( 1)              yes 注意类型第二个字段是日期而不是日期时间...... 我想显示表中所有日期都在''日期'的记录字段... 我当前的查询是 - cmd =新的SqlClient.SqlCommand(select * from staffpresentee where date =& Date.Now.Date,cn) dr = cmd.ExecuteReader for dr = cmd.ExecuteReader我收到错误操作数类型冲突:日期与int不兼容 i尝试select * from staffpresentee查询而没有正确运行的where子句... 解决方案 I am trying to display records from a table named staffpresentee from a database using the where clause...i am using visual studio 2010...the table design is as follows-     fieldname                  datatype          allownull1    staff_id (fk)              numeric(18,0)       yes2      date                           date                no3    present                       char(1)             yesNote that the type of the 2nd field is date and not datetime...I want to display all records from the table that have today''s date int the ''date'' field...My current query is-cmd = New SqlClient.SqlCommand("select * from staffpresentee where date=" & Date.Now.Date, cn)dr = cmd.ExecuteReaderfor dr = cmd.ExecuteReader i get the error "Operand type clash: date is incompatible with int"i tried the select * from staffpresentee query without the where clause it runs correctly... 解决方案 这篇关于VB.NET错误:操作数类型冲突:日期与int不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-13 08:06