问题描述
亲爱的人
我是开发人员.在使用Crystal Report进行数据显示时,我遇到了困难:例如:当数据库名称及其属性更改时,数据无法在Crystal Report中显示.但是,当我从其属性显示sql查询时,它将保留以前的资源.我以前的数据库名称是Sheba,但我用LaserDB重命名了它.请查看下面的代码,并尽快帮助我.我将永远感激你.
Dear Someone
I am Developer. I have in difficulties regarding datashow with crystal report: such: Data not show with Crystal Report when database name is changed with its properties. but when I show sql query from its properties it keeps the previous resources. I have previous database name was Sheba but I rename it with LaserDB. Plz see the below Code and help me ASAP. I will gratefull to you forever.
<pre lang="sql">SELECT "Doctor"."DoctorName", "Patient"."PatientName", "Patient"."Age", "PatientTest"."Discount", "PatientTest"."Paid", "Test"."TestName", "Test"."TestCharge", "PatientTest"."NetAmount", "Doctor"."Qualification", "Doctor"."Tittle", "PatientTest"."RecitID", "PatientTest"."DaliveryTime", "Patient"."Sex", "Patient"."Phone", "PatientTest"."DeliveryDate", "login"."username"
FROM (((("Sheba"."dbo"."PatientTest" "PatientTest" INNER JOIN "Sheba"."dbo"."TestResult" "TestResult" ON "PatientTest"."RecitID"="TestResult"."RecitID") INNER JOIN "Sheba"."dbo"."Patient" "Patient" ON "PatientTest"."PatientID"="Patient"."PatientID") INNER JOIN "Sheba"."dbo"."login" "login" ON "PatientTest"."login_id"="login"."login_id") INNER JOIN "Sheba"."dbo"."Test" "Test" ON "TestResult"."TestID"="Test"."TestID") INNER JOIN "Sheba"."dbo"."Doctor" "Doctor" ON "Patient"."DoctorID"="Doctor"."DoctorID"
WHERE "PatientTest"."RecitID"=11
推荐答案
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Private Sub ConfigureCrystalReports()
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
myConnectionInfo.DatabaseName = "Northwind"
myConnectionInfo.UserID = "limitedPermissionAccount"
myConnectionInfo.Password = "1234"
myConnectionInfo.ServerName = "dholmes_50701"
Dim reportPath As String = Application.StartupPath & "\" & "NorthwindCustomers.rpt"
myCrystalReportViewer.ReportSource = reportPath
SetDBLogonForReport(myConnectionInfo)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ConfigureCrystalReports()
End Sub
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo)
Dim myTableLogOnInfos As TableLogOnInfos = myCrystalReportViewer.LogOnInfo
For Each myTableLogOnInfo As TableLogOnInfo In myTableLogOnInfos
myTableLogOnInfo.ConnectionInfo = myConnectionInfo
Next
End Sub
End Class
但是我建议在设计Crystal报表时使用XSD文件作为源.
But I alwase suggest to use XSD file as source while designing Crystal report.
这篇关于更改数据库名称时,数据不与Crystal Report一起显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!