如何从表关系制作水晶报表?
你好,我想从表关系中生成水晶报表.
我已经建立了一个非关联表,并在水晶报表中显示了记录成功.
但是,当我尝试建立关系表时,该记录未显示在Crystal报表中.对于非关系表,我尝试使用相同的方法,但是它是有效的.
这是我的代码:
Hello, I want to make a crystal report from table relation.
I''ve make for a non relation table, and the record success shown in the crystal report.
But, when I try for a relation table, the record is not displayed in the crystal report. I try with the same way for non-relation table, but it''s work.
Here is my code :
Option Explicit On
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data.SqlClient
Public Class PrintJadwalKuliah
Dim xKoneksi As New SqlConnection
Dim xAdapter As New SqlDataAdapter
Dim obj_RepDoc As New ReportDocument
Dim xDataset As New _FKIP_UNILAKDataSet()
Private Sub PrintJadwalKuliah_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
xKoneksi.ConnectionString = "Data Source=RAGAZ-PC\SQLEXPRESS;Initial Catalog=FKIP-UNILAK;Integrated Security=True"
xAdapter = New SqlDataAdapter("SELECT Hari.nama_hari , Jam.jam_kuliah , Jam.selesai , Ruang.Nama_Ruangan FROM slot INNER JOIN Hari ON slot.Id_hari = Hari.Id_hari INNER JOIN Jam ON slot.Id_Jam = Jam.Id_Jam INNER JOIN Ruang ON slot.Id_Ruangan = Ruang.Id_Ruangan", xKoneksi)
xAdapter.Fill(xDataset, "Jadwal")
obj_RepDoc = New CrystalReport_slotcoba
obj_RepDoc.SetDataSource(xDataset)
CrystalReportViewer1.ReportSource = obj_RepDoc
End Sub
End Class
当我尝试向datagrid视图显示选择查询"时,显示的记录成功(我认为我的选择查询"很好),那么对此有什么解决方案?
抱歉,我的英语不好,我是印尼人:)
When I try to show the "Select query" to datagrid view, the record succes shown ( I think my "select Query" is fine), So what is the solution for this one??
Sorry, my english bad, I''m an indonesian :)
使用该查询在数据库中创建视图.然后只是
Create a view in your DB with that query. And then just
SELECT * FROM YourNewView
这应该可以正常工作.
This should work without problems.