如何使用两个数据表创建动态数据集 [英] How to create a dynamic dataset with two datatable

查看:69
本文介绍了如何使用两个数据表创建动态数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个包含两个数据表的动态数据集,这样我就可以使用水晶报表中的数据集我想从访问数据库中放入值并将值放入数据集中的两个数据表中现在我是能够在水晶报告中使用一个数据集和一个数据表



我尝试过:



Private Sub ChallanReports_Load(发送者作为对象,e作为EventArgs)处理MyBase.Load

如果rpt2 =ChallanBlack那么

Dim objrpt As New ChallanBlack''水晶报告

Dim query As String =select * from Challan where ChallID =& dts2

Dim ad As OleDbDataAdapter = New OleDbDataAdapter(query,conn)

Dim ds As ChallanDataSet = New ChallanDataSet'''数据集

ad。填充(ds,Challan)''数据表

objrpt.SetDataSource(ds)

CrystalReportViewer1.ReportSource = objrpt



ElseIf rpt2 =BGLChallanBlack然后

结束如果

结束次级

结束类

I want to create a dynamic dataset with two data table such that I can use the dataset in the crystal report I want to put the values from access database and put the values into the two data tables in the dataset Right now I am able to use one dataset and one data table in the crystal report

What I have tried:

Private Sub ChallanReports_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If rpt2 = "ChallanBlack" Then
Dim objrpt As New ChallanBlack '' crystal report
Dim query As String = "select * from Challan where ChallID = " & dts2
Dim ad As OleDbDataAdapter = New OleDbDataAdapter(query, conn)
Dim ds As ChallanDataSet = New ChallanDataSet '''dataset
ad.Fill(ds, "Challan") '' datatable
objrpt.SetDataSource(ds)
CrystalReportViewer1.ReportSource = objrpt

ElseIf rpt2 = "BGLChallanBlack" Then
End If
End Sub
End Class

推荐答案

如果您有两个表并且想要创建包含两者的数据的视图,请在SQL Server中创建一个视图并连接到该
If you have two tables and you want to create a view that contains data from both, create a view in your SQL Server and connect to that

这篇关于如何使用两个数据表创建动态数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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