用两个和一个有什么区别?反正DataTable又不能重名。用一个不是很好吗?表名称不同而已。
解决方案 »
- 急求,C#,打印程序中LPT1可以打印,而USB001无法打印。
- DevExpress 如何实现如图所示效果
- 请问VISUAL studio 2005 以上的版本有没有类似DELPHI用的 CnWizards这样能在控件上能直接显示其控件名称的功能的插件。
- c#
- c#winform mysql 乱码
- 急,急,将oracle中blob类型数据怎么插入到sql server中image字段??
- vs工具箱控件不可用 是怎么回事
- C#里怎么用adodb啊?
- 怎么获取一个窗体的句柄?
- System.ArgumentException: 已添加项。字典中的键:“winbootdir” 所添加的键:“winbootdir”
- 怎样在c#中DataGrid中的每一行末尾插入复选框??
- winform中如何执行一个外部的exe文件?
SqlConnection cn=new SqlConnection(strConn);
string cmd=@"你的SELECT语句";
SqlCommand mycmd=new SqlCommand(cmd,cn);
SqlDataAdapter da=new SqlDataAdapter(cmd,cn);
DataSet ds=new DataSet();
cn.Open();
da.Fill(ds,"TableName"); retname myreport=new repname();
myreport.SetDataSource(ds);
this.CrystalReportViewer1.ReportSource=myreport;
PrintRpt1.Rpt=myreport;
myreport.SetDataSource(PersonData);
myreport.SetDataSource(StationData);
http://www.dotnet247.com/247reference/msgs/16/82642.aspx
//将两个表(数据集)的数据放到一个表(数据集)中
public DataTable GetHortationByPIDUseTable(string pid)
{
DataTable hrt=new DataTable();
hrt=ds.tb_Hortation.Copy();
int i=hrt.Rows.Count-1;
while(i>=0)
{
if(hrt.Rows[i]["c_personCodeH"].ToString().Trim()!=pid)
{
hrt.Rows[i].Delete();
}
i--;
}
hrt.AcceptChanges();
//增加关联基本(信息姓名,身份证号)
DataTable pt=GetPersonByPIDUseTable(pid);
if(pt.Rows.Count>0)
{
hrt.Columns.Add("c_Chinesename", typeof(String));
hrt.Columns.Add("c_PersonID", typeof(String));
for(int j=0;j<hrt.Rows.Count;j++)
{
hrt.Rows[j]["c_Chinesename"]=pt.Rows[0]["c_Chinesename"];
hrt.Rows[j]["c_PersonID"]=pt.Rows[0]["c_PersonID"];
}
}
hrt.AcceptChanges();
return hrt;
}
//报表窗体关联
ClientComponent comp=ClientComponent.GetInstance();
crp.SetDataSource(comp.GetHortationByPIDUseTable("12000000000000"));
crystalReportViewer1.ReportSource=crp;