Quantcast
Channel: VBForums - Reporting
Viewing all articles
Browse latest Browse all 597

i am new with vb.net 2008 to develop Reports

$
0
0
Hello Experts;

Good day. I want to generate the rldc report with parameters using. The database is used is .mdb. I design the report by using wizard and set parameters names.

When i run the select statement the Message box shows all the records but the report shows only columns heading. Here is the code i used
Code:

Private Sub view_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles view.Click
        Dim frm As New Form1()' Load the Form which have a Report Viwer1
        Dim ds As New DataSet()
        Dim Param(4) As ReportParameter ' Parameters array also set the parameters by using Report->> Set Parameters
        Dim strSQL As String
        'Dim pa() As String = {"Area_ID", "En_Des", "Ur_Des", "En_Detail", "Un_Detail"}
        'Dim it() As String = {"Area_ID", "En_Des", "Ur_Des", "En_Detail", "Un_Detail"}

        oConnection.Connect()' Connect to the database
        strSQL = "SELECT * FROM Area "
        Try
            Dim da As New OleDbDataAdapter(strSQL, oConnection.conn)
            da.Fill(ds)
            MessageBox.Show("The rows fetch from database is    " + ds.Tables(0).Rows.Count.ToString())' it shows that table have two rows
            If ds.Tables(0).Rows.Count > 0 Then
                For i = 0 To ds.Tables(0).Rows.Count - 1
                    MessageBox.Show(" The data from the database read is as" + ds.Tables(0).Rows(i).Item("Area_ID").ToString())' shows records
                    MessageBox.Show(" The data from the database read is as" + ds.Tables(0).Rows(i).Item("En_Des").ToString())
                        Param(0) = New ReportParameter("Area_ID", ds.Tables(0).Rows(i).Item("Area_ID").ToString())
                        Param(1) = New ReportParameter("En_Des", ds.Tables(0).Rows(i).Item("En_Des").ToString())
                        Param(2) = New ReportParameter("Ur_Des", ds.Tables(0).Rows(i).Item("Ur_Des").ToString())
                        Param(3) = New ReportParameter("En_Detail", ds.Tables(0).Rows(i).Item("En_Detail").ToString())
                        Param(4) = New ReportParameter("Un_Detail", ds.Tables(0).Rows(i).Item("Un_Detail").ToString())
                        frm.ReportViewer1.LocalReport.SetParameters(Param)
                                  Next
            End If
        Catch ex As Exception
           
            Exit Sub
        End Try
        oConnection.disConnect()
        ds.Dispose()
        'frm.ReportViewer1.RefreshReport()
        frm.ShowDialog() ' show the report as dialog

    End Sub


Please help me how i fix it and show all records dynamically in the report.

If any example of code with access database to prepare report which shows more than one row in the report please send me the link.

Thanking you i will remain

Viewing all articles
Browse latest Browse all 597

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>