表格搜索和水晶报表 [英] Form Search and Crystal Reports

查看:82
本文介绍了表格搜索和水晶报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个水晶报表,该报表显示从Windows窗体(用作数据库的搜索窗体)中搜索到的数据.

例如(表单搜索):

销售

从:2009年10月

至:2010年1月

如何将表单搜索链接到水晶报表以显示2009年10月至2010年1月的销售数据?

如果发件人"是textbox1,而发件人"是textbox2,该如何创建查询?

代码正确吗?


I want to create a crystal report that shows the data I searched from a windows form that acts as a search form for a database.

for example (form search):

Sales

From: October 2009

To: January 2010

How do I link the form search to the crystal report to show Sales data from October 2009 to January 2010?

if From is textbox1 and To is textbox2, how do I create a query?

is the code correct?


SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandType=CommandType.Text
cmd.CommandText= "SELECT * FROM Orders2 WHERE Monthname = '" + textBox1.Text.ToString() + "'

推荐答案

通过 Query ?

您只需要使用适当的WHERE子句构成一个查询即可,并且一切就绪.只需使用查询获取数据,然后使用数据显示在您的Crystal报表中即可.
via Query?

You simply need to form a query with proper WHERE clause and you are all set. Just use the query to get the data and then use the data to display in your crystal report.


这篇关于表格搜索和水晶报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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