a better way to use parameters in your query string, such as string strSQLtwo = "select * from hard where ComeTime between @startdate and @enddate";
detail in http://blog.csdn.net/knight94/archive/2006/04/15/664530.aspx
看看你的ComeTime字段是什么类型的,如果是日期的就不用加单引号了!
执行: string strSQL = "select * from hard where ComeTime between 2006-05-01 and 2006-05-30"; 结果是没有数据 绑定的控件是空的 但是没有出错string strSQL = "select * from hard where ComeTime between @2006-05-01 and @2006-05-30"; 提示至少有一个参数没有被指定
to string strSQL = "select * from hard where ComeTime between @2006-05-01 and @2006-05-30"; 提示至少有一个参数没有被指定string strSQLtwo = "select * from hard where ComeTime between @startdate and @enddate";// Set parameters with value to your DB command yourComm.Parameters.Add( "@startdate", yourStartDate ); yourComm.Parameters.Add( "@enddate", yourenddate );// then execute your command
string strSQLtwo = "select * from hard where ComeTime between '2006-5-1 00:00:00' and '2006-5-31 00:00:00'";
string strSQLtwo = "select * from hard where ComeTime between @startdate and @enddate";
http://blog.csdn.net/knight94/archive/2006/04/15/664530.aspx
string strSQL = "select * from hard where ComeTime between 2006-05-01 and 2006-05-30";
结果是没有数据
绑定的控件是空的
但是没有出错string strSQL = "select * from hard where ComeTime between @2006-05-01 and @2006-05-30";
提示至少有一个参数没有被指定
提示至少有一个参数没有被指定string strSQLtwo = "select * from hard where ComeTime between @startdate and @enddate";// Set parameters with value to your DB command
yourComm.Parameters.Add( "@startdate", yourStartDate );
yourComm.Parameters.Add( "@enddate", yourenddate );// then execute your command