从数据库中获取指定值并在水晶报表上显示 [英] get specified values from database and show on crystal report

查看:71
本文介绍了从数据库中获取指定值并在水晶报表上显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从数据库中获取指定值并将其显示在数据库中。

我有以下代码。

I want to get a specified value from database and show it on database.
I have the following code.

 SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=PFMS;User ID=sa;Password=123!@#abc");
con.Open();
                
int c = 1;
SqlCommand cmd = new SqlCommand("select * from tbl_expense where form_id=" + c , con);
                 
SqlDataAdapter da = new SqlDataAdapter(cmd);
CrystalReport1 rp = new CrystalReport1();
DataSet ds = new DataSet();
            
da.Fill(ds, "tbl_expense");
dt.Load(dr);
rp.SetDataSource(ds);



并且它不显示报告。请告诉我我需要做什么。

提前感谢


and it does not show the report. please tell me what i need to do.
thanks in advance

推荐答案

你需要水晶报告查看器才能显示水晶报告
crystalreportviewer1.ReportSource = rp;
you need crystal report viewer to display the crystal report
crystalreportviewer1.ReportSource=rp;


这篇关于从数据库中获取指定值并在水晶报表上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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