如何从两个单独的表中的水晶报表中插入数据库的值 [英] how to insert values of database in crystal report from two seperate tables

查看:74
本文介绍了如何从两个单独的表中的水晶报表中插入数据库的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,弗朗斯,我正在做一个项目,在那个项目中我面临着一个特定的项目.我在两个单独的表(即tblCustomer和tblVehicle)中有数据,我需要做的是在Crystal报表中生成清单,但其中包括这两个表中的列名.我已经通过代码从单个表生成了Crystal报表.

hello frens, i am doing a project and in that project i m facing a particular project. i have datas in two separate tables namely tblCustomer and tblVehicle, what i need to do is generate a slip in crystal report but it includes column names from these two tables i have done the crystal report generation from single table through the code

string sql = "select Vehentrytime,Vehlane from tblVehicle where Vehid=" + vehicleid + "";

 SqlCommand cmd = new SqlCommand(sql, cnn);
 SqlDataAdapter dscmd = new SqlDataAdapter(cmd);
   DataSet ds = new DataSet();
 dscmd.Fill(ds, "Vehicle");
 cnn.Close();
CrystalReport1 objRpt = new CrystalReport1();
objRpt.SetDataSource(ds.Tables["Vehicle"]);
crystalReportViewer1.ReportSource = objRpt;
crystalReportViewer1.Refresh();



但不是来自两个表,请提供代码



but not from two table, please provide with the code

推荐答案

在设计Crystal报表时,应在Crystal报表源中添加多个表.
You should add multiple tables in crystal report source at the time of designing the crystal report.


这篇关于如何从两个单独的表中的水晶报表中插入数据库的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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