日期:2014-05-18  浏览次数:20437 次

select * frome tablename where time between 的问题
C# code
string strsql = "select * for tablename where  网上申报时间 between '" + TextBox2.Text + "' and '"+ TextBox3.Text +"'";
 

这句话有问题吗?

------解决方案--------------------
for -> from
------解决方案--------------------
Between 的是时间值而不是字符串 ,最好转换下

------解决方案--------------------
有什么问题,放到查询分析器或代码中试试
------解决方案--------------------
单引号好像不需要把。都是字符类型的拼接
------解决方案--------------------
探讨
有什么问题,放到查询分析器或代码中试试

------解决方案--------------------
两个text分别是什么
------解决方案--------------------
C# code

strsql = "select * form tablename where 网上申报时间 between convert(datetime,'" + TextBox2.Text + "') and convert(datetime,'"+ TextBox3.Text +"')"