问题描述
我有 在sql查询中给出以下命令
日期时间todaysdate =新日期时间(2012年,09,05);
的SqlCommand objCommand = objconnection.CreateCommand();
objCommand.Parameters.AddWithValue(QUOT; @ EMPREF" ;, empref);
objCommand.Parameters.AddWithValue(QUOT; @ STARTDATE" ;, todaysdate);
objCommand.CommandText = QUOT;选择EMPREF,STARTDATE从TMSFC凡EMPREF = @ EMPREF和STARTDATE> = @ STARTDATE" ;;
但是当我运行查询时是 显示如下。请帮助我如何修复错误
选择EMPREF,STARTDATE 来自TMSFC EMPREF = 10472和 STARTDATE> = @STARTDATE
polachan
I have given the following command in sql query
DateTime todaysdate = new DateTime(2012, 09, 05);
SqlCommand objCommand = objconnection.CreateCommand();
objCommand.Parameters.AddWithValue("@EMPREF", empref);
objCommand.Parameters.AddWithValue("@STARTDATE", todaysdate);
objCommand.CommandText = "select EMPREF,STARTDATE from TMSFC Where EMPREF = @EMPREF and STARTDATE >= @STARTDATE";
But when I run the query is showing as follows . Please help how can I fix the error
select EMPREF,STARTDATE from TMSFC Where EMPREF = 10472 and STARTDATE >= @STARTDATE
polachan
这篇关于日期条件不能在命令文本参数中工作请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!