none
Microsoft report with Dataset RRS feed

  • Question

  • hi i created a dataset and a datatable

    then add new microsoft report and place the fields from the dataset

    then i add a form and add a Microsoft report viewer

    then i selet local report the added report

    then i fill the created dataset-datatable with datas then i showdialog the report viewer form

    but the report is empty hw to solve this

     Dim strcmd As String = "select filename,status,processeddate from files where (processeddate between #" & fromdate.Text & " 12:00:00 AM# and #" & todate.Text & " 11:59:59 PM#) "
    
        If statusList.SelectedIndex = 1 Then
          strcmd = strcmd & "and status=true "
        ElseIf statusList.SelectedIndex = 2 Then
          strcmd = strcmd & "and status=false "
        End If
        Dim cn As OleDbConnection
        Dim cmd As New OleDbCommand
        Dim lfiles As New DataTable
        Dim oledbda As New OleDbDataAdapter()
        cn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\xxx.accdb;")
        cmd = New OleDbCommand(strcmd, cn)
        cn.Open()
        oledbda.SelectCommand = cmd
        oledbda.Fill(lfiles)
        cn.Close()
        cn.Dispose()
        cmd.Dispose()
        oledbda.Dispose()
    
        Dim files As New files
        files.Clear()
        Dim tbl As DataTable = files.Tables("files")
    
        If lfiles.Rows.Count > 0 Then
    
          For i As Integer = 0 To lfiles.Rows.Count - 1
            Dim row As DataRow = tbl.NewRow()
            row.Item("filename") = lfiles.Rows(i)(0)
            If Convert.ToBoolean(lfiles.Rows(i)(1)) Then
              row.Item("status") = "Success"
            Else
              row.Item("status") = "Failed"
            End If
            row.Item("date") = Convert.ToDateTime(lfiles.Rows(i)(2)).ToString("MM/dd/yyyy")
            row.Item("time") = Convert.ToDateTime(lfiles.Rows(i)(2)).ToString("HH:mm:ss")
            tbl.Rows.Add(row)
    
          Next
          tbl.AcceptChanges()
          files.AcceptChanges()
          Print.ShowDialog()
        Else
          MessageBox.Show("No Records found!")
        End If
    

    Dim files As New files
            files.Clear()
            Dim tbl As DataTable = files.Tables("files")

     files is Dataset i previously added in design time the table name also files

    Thursday, October 21, 2010 9:42 AM

All replies

  • Hi......

    To show data on the ReportView follow these steps.

    1) Select ReportViewer which is on the form.

    2) Now you can see right arrow on upper corner side of the reportviewer's right side.

    3) now click on it. One dialog will be opened that is ReportViewer Tasks.

    4) In it Choose your rdlc file from the dropdown list.

    5) Now click on third option that is Rebind Data Sources.

    6)Go to code behind page and write bellow lines in constructor.

    reportViewer1.LocalReport.RefreshReport();

    reportViewer1.LocalReport.Refresh();

    that's it.


    Regards, Hiren Bharadwa
    Thursday, October 21, 2010 12:09 PM
  • Thnk u for ur reply but i select fields from the dataset in the rdlc

    i got error the report definition for the report "xxx.rdlc" has not been specified

    Friday, October 22, 2010 4:36 AM