Hiển thị kết quả từ 1 đến 10 / 10
  1. #1
    Tham gia
    29-04-2008
    Bài viết
    215
    Like
    0
    Thanked 0 Times in 0 Posts

    Tạo báo cáo Report trong C#

    mình đang cần làm báo cáo trong C# bằng Crystal Report, nhưng mình chỉ biết cách làm kéo thả, đó là Add vào một dataset và một Crystal Report, crystalReportViewer1 rồi chọn nguồn dữ liệu, cho các điều khiển đó
    nhưng cách đó chỉ làm được với CSDL nằm trên máy Local còn nếu trên môi trường mạng lan thì làm thế CSDl không nằm trên máy chứa ứng dụng
    bác nào có code về phần này cho xin
    thank

    [=========> Bổ sung bài viết <=========]

    có ai làm vấn đề này chưa vậy
    Được sửa bởi longtqdayma lúc 06:18 ngày 29-03-2009 Reason: Bổ sung bài viết
    Quote Quote

  2. #2
    Tham gia
    10-10-2005
    Location
    Quy Nhơn
    Bài viết
    185
    Like
    0
    Thanked 0 Times in 0 Posts
    cách đơn giản là bạn tạo 1 dataset trong VS, add table vào giống như bạn hay làm với crystal report
    Sau đó tại 1 form, kéo crystalreportviewer vào
    trong form_Load:
    - fill dữ liệu vào table mà bạn tạo ở trên
    - fileReport.setDataSource(datatable)
    - set reportSource cho crystalreportviewer (crystalreportviewer.ReportSource = fileReport)

  3. #3
    Tham gia
    29-04-2008
    Bài viết
    215
    Like
    0
    Thanked 0 Times in 0 Posts
    bác có thể làm cho em một ví dụ demo không bởi vì khi làm thế thì cách trình bày trên Crystal Report như thế nào tức là khi mình làm theo kiểu kéo thả lúc đó trên cửa sổ thiết kết của Report ta có thể đinh vị trí hiển thị dữ liệu,còn cách bac nói thế thì đinh vị trí hiển thị như thế nao
    . em làm mà dữ liệu nó cũng có hiển thị lên được
    thank

  4. #4
    Tham gia
    10-10-2005
    Location
    Quy Nhơn
    Bài viết
    185
    Like
    0
    Thanked 0 Times in 0 Posts
    khi bạn tạo mới 1 file .rpt, nó cho bạn chọn datasource, chọn vào ProjectData, ADO.NET Dataset, sau đó chọn dataset mình mới tạo, add datatable trong list vào, lúc đó mình có thể kéo thả như bạn hay làm

    có gì thì add Y!M ddtmy2002, mình sẽ giúp

  5. #5
    Tham gia
    30-03-2009
    Bài viết
    30
    Like
    0
    Thanked 0 Times in 0 Posts
    Để tạo report có 2 cách.
    - Crystal report
    - Microsoft report

    Đây là code:
    Microsoft Report
    reportViewer1.Clear();
    reportViewer1.LocalReport.DataSources.Clear();
    reportViewer1.LocalReport.ReportPath = @"tenreport.rdlc";
    ReportDataSource reportDataSource = new ReportDataSource("tendataset_tentable", dataTable);
    reportViewer1.LocalReport.DataSources.Add(reportDa taSource);
    reportViewer1.LocalReport.Refresh();
    reportViewer1.RefreshReport();


    Crystal Report
    ReportDocument reportDocument = new ReportDocument();
    reportDocument.Load(@"tenReport.rpt");
    reportDocument.SetDataSource(dataTable);
    crystalReportViewer1.ReportSource = reportDocument;
    crystalReportViewer1.RefreshReport();

    HKG Education Center
    http://education.huukhang.com/newclasses.aspx

  6. #6
    Tham gia
    17-10-2006
    Bài viết
    80
    Like
    0
    Thanked 0 Times in 0 Posts
    Mình đang cần cái này cảm ơn hkgeducation

  7. #7
    Tham gia
    21-04-2009
    Bài viết
    2
    Like
    0
    Thanked 0 Times in 0 Posts
    Cảm ơn bạn hkgeducation.

  8. #8
    Tham gia
    27-09-2008
    Bài viết
    5
    Like
    0
    Thanked 0 Times in 0 Posts

    Print report

    Private Sub ConfigureCrystalReports()
    Dim row As DataRow
    If DataGridView_THIETBI.Rows.Count > 0 Then

    For i As Integer = 0 To Thietbi.Rows.Count - 1
    row = Thietbi.NewRow()
    row(0) = DataGridView_THIETBI.Rows.Item(i).Cells.Item("MATH IETBI").Value
    row(1) = DataGridView_THIETBI.Rows.Item(i).Cells("tenthietb i").Value

    ' S.Rows.Add(row)
    Next
    Else
    MessageBox.Show("Chưa có dữ liệu(*)!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
    Me.Close()

    End If



    Dim objText As TextObject = CType(report.ReportDefinition.Sections(1).ReportOb jects("text9"), TextObject)
    objText.Text = frmMain.StatusBarPanel2.Text
    objText.Border.BorderColor = Color.Red
    GetTextObject("text10").Text = "Ngöôøi laäp baûng"
    ' report = New Report_TB()
    report.SetDataSource(Thietbi)
    End Sub
    Private Sub Button4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    ConfigureCrystalReports()
    PrintDialog1.ShowDialog()
    report.PrintToPrinter(1, False, 1, 99)
    End Sub

  9. #9
    Tham gia
    08-01-2009
    Bài viết
    8
    Like
    0
    Thanked 0 Times in 0 Posts
    ban nao co video lam hoan thien Report ko? Gui cho minh voi. Minh dang hoc nhung khong biet lam the nao cả. Gửi vào Mail :thegioimoi2115@gmail.com

  10. #10
    Tham gia
    28-05-2009
    Bài viết
    2
    Like
    0
    Thanked 0 Times in 0 Posts
    co anh chị nào giúp em tìm hiểu rỏ về bên mạng ko một số thủ thuật bên mạng đó

Bookmarks

Quy định

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể sửa bài viết của mình
  •