两个日期之间的Crystal Report Viewer选择 [英] Crystal Report Viewer Selection between two dates

查看:77
本文介绍了两个日期之间的Crystal Report Viewer选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

crystalReportViewer1.SelectionFormula = "{salesreport.Date} >=Date(#" + dateTimePicker1.Text + "# ) and {salesreport.Date} <= Date(#" + dateTimePicker2.Text + "#) ";


我已将数据库中的日期字段设置为varchar,错误为msg
错误消息是字符串是必需的"

将字段类型更改为DATETIME后,报告显示为空白页.


i had set the date field in database as varchar that the error msg
the error message is "string is required"

after changed the field type as DATETIME, the report displayed empty page.

推荐答案

如果您的日期列是datetime类型,请尝试以下代码.我的意思是只将date()保留在代码中.
if your date column is datetime type then try below code. i mean just leave the date() in the code.
string strFormula = "";
strFormula = "{salesreport.Date}>=#" + txtFromDate.Text + "# and {salesreport.Date}<= #" + txtToDate.Text + "#";
crystalReportViewer1.SelectionFormula = strFormula;


这篇关于两个日期之间的Crystal Report Viewer选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆