Tôi có báo cáo tinh thể hoạt động tốt khi sử dụng DSN
làm nguồn dữ liệu. Vấn đề là tôi đang sử dụng tập dữ liệu ngay bây giờ. Dataset chứa tất cả các bảng tôi cần và tôi đang điền nó với dữ liệu từ cơ sở dữ liệu bằng cách sử dụng thủ tục lưu sẵn. Nhưng, theo cách này, nó đang ném một lỗi: "Missing Parameters
".Không thể liên kết báo cáo tinh thể đúng cách khi sử dụng tập dữ liệu, hiển thị thông số thiếu
tôi đang làm như sau:
Bước 1: Tạo Dataset1.xsd
và sử dụng data connections
chèn tất cả cần tables
từ cơ sở dữ liệu trong đó.
Bước 2: Cho data source
báo cáo sử dụng database expert
như Dataset1.xsd
Bước 3: Populating dữ liệu sử dụng thủ tục lưu trữ trong tập dữ liệu và sau đó tạo ra thể hiện của Dataset1
và sáp nhập dữ liệu từ dữ liệu thiết lập để Dataset 1
dụ.
Mã của tôi để lấy dữ liệu từ cơ sở dữ liệu và sau đó hợp nhất rằng để Dataset1
dụ và cho rằng như nguồn để báo cáo tinh thể như sau:
Private Sub ReportByDataset(ByVal rptDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument)
'new code
Dim myConnection As New SqlClient.SqlConnection()
'myConnection.ConnectionString = "server= (local)\NetSDK;database=pubs;Trusted_Connection=yes"
Dim ds As New DataSet1
myConnection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("HighriseContractingWebConnectionString").ConnectionString
myConnection.Open()
Dim MyCommand As New SqlClient.SqlCommand()
MyCommand.Connection = myConnection
MyCommand.CommandText = "SP_Web_GetReportTables"
MyCommand.CommandType = CommandType.StoredProcedure
Dim MyDA As New SqlClient.SqlDataAdapter()
MyDA.SelectCommand = MyCommand
Dim myDS As New DataSet
MyDA.Fill(myDS)
myConnection.Close()
ds.Tables("RABill_RPT").Merge(myDS.Tables(0), MissingSchemaAction.Ignore)
myDS.Tables(0).Reset()
ds.Tables("RA_bills").Merge(myDS.Tables(1), MissingSchemaAction.Ignore)
ds.Tables("Work_Completion").Merge(myDS.Tables(2), MissingSchemaAction.Ignore)
ds.Tables("contractor").Merge(myDS.Tables(3), MissingSchemaAction.Ignore)
ds.Tables("WO_Header").Merge(myDS.Tables(4), MissingSchemaAction.Ignore)
ds.Tables("Project").Merge(myDS.Tables(5), MissingSchemaAction.Ignore)
ds.Tables("contractor_1").Merge(myDS.Tables(6), MissingSchemaAction.Ignore)
ds.Tables("Users").Merge(myDS.Tables(7), MissingSchemaAction.Ignore)
ds.Tables("Users_Approved").Merge(myDS.Tables(8), MissingSchemaAction.Ignore)
ds.Tables("voucher").Merge(myDS.Tables(9), MissingSchemaAction.Ignore)
ds.Tables("Employee_Approve").Merge(myDS.Tables(10), MissingSchemaAction.Ignore)
ds.Tables("Employee").Merge(myDS.Tables(11), MissingSchemaAction.Ignore)
ds.Tables("Account").Merge(myDS.Tables(12), MissingSchemaAction.Ignore)
ds.Tables("TDS").Merge(myDS.Tables(13), MissingSchemaAction.Ignore)
ds.Tables("WO_Detail").Merge(myDS.Tables(14), MissingSchemaAction.Ignore)
ds.Tables("V_WO_BlockTaskNo").Merge(myDS.Tables(15), MissingSchemaAction.Ignore)
ds.Tables("TASK").Merge(myDS.Tables(16), MissingSchemaAction.Ignore)
ds.Tables("Cont_Voucher").Merge(myDS.Tables(17), MissingSchemaAction.Ignore)
ds.Tables("Cont_Voucher_1").Merge(myDS.Tables(17), MissingSchemaAction.Ignore)
ds.Tables("Cont_Voucher_2").Merge(myDS.Tables(17), MissingSchemaAction.Ignore)
ds.Tables("Company").Merge(myDS.Tables(18), MissingSchemaAction.Ignore)
''new code ends
rptDoc.SetDataSource(ds)
CRReport.HasCrystalLogo = False
CRReport.HasToggleGroupTreeButton = False
CRReport.ReportSource = rptDoc
CRReport.DataBind()
End Sub
Nhưng nó không làm việc, tôi thiếu gì. Cùng hoạt động tốt bằng cách sử dụng DSN
Nó không phải là vấn đề của các thông số và cùng làm việc tốt cách khác.
Lưu ý: Tôi biết trên mã không phải là bộ nhớ tối ưu hóa, nhưng mối quan tâm của tôi bây giờ là bằng cách nào đó làm cho nó hoạt động, tôi sau này có thể tối ưu hóa nó
Dưới đây hình ảnh cho thấy Dataset1 như nguồn dữ liệu
Ur thiếu cha mẹ ur tôi đoán :) – killer
Cái gì !! Tôi không hiểu bạn. – user1923238
là điều này quetion nhiệm vụ nhà của chúng tôi? – killer