Results 1 to 9 of 9

Thread: No data on report

  1. #1
    Arthas_ss is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2012
    Location
    Jordan
    Posts
    5
    Reputation
    0

    No data on report

    Hi..

    i am trying to make a "RDLC" report but unfortunately no data shows .. so i would like to know what is wrong with my code ..

    thank you ..


    and here is the code ..


    Imports System.Data
    Imports System.Data.Sql
    Imports System.Data.OleDb
    Imports System.Configuration
    Imports Microsoft.Reporting.WinForms


    Public Class Form1
    Dim Con_String As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\Admin\Desktop\Marketing Sheet\Marketing_Sheet\Marketing_Sheet\Data\Marketi ng_Survey.accdb;Persist Security Info=False;" 'Connection string from App.Config
    Dim DA As OleDbDataAdapter
    Dim DS As New DataSet
    Dim Con_Dia As New OleDbConnection(Con_String)
    Dim objCmd As New OleDbCommand
    Dim rptDataSource As ReportDataSource
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Con_Dia.Open()

    If Con_Dia.State = ConnectionState.Open Then

    DA = New OleDbDataAdapter("SELECT * FROM Information_Sheet", Con_Dia)
    If DA.Fill(DS, "Information_Sheet") > 0 Then
    DS.DataSetName = "xxx"
    Dim dt As New DataTable
    dt = DS.Tables(0)

    With Me.ReportViewer1.LocalReport
    .ReportPath = "c:\documents and settings\admin\my documents\visual studio 2010\Projects\WindowsApplication2\WindowsApplicati on2\Report1.rdlc"
    .DataSources.Clear()
    End With

    'rptDataSource = New ReportDataSource("luai", DS.Tables("Information_Sheet"))
    ReportViewer1.ProcessingMode = ProcessingMode.Local

    Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("xxx", DS.Tables("Information_Sheet")))


    End If





    End If
    Con_Dia.Close()
    ReportViewer1.RefreshReport()

    End Sub


    End Class

  2. #2
    Dunfiddlin's Avatar
    Dunfiddlin is offline VB.NET Forum Master
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2012
    Posts
    253
    Reputation
    31
    'rptDataSource = New ReportDataSource("luai", DS.Tables("Information_Sheet"))

    Did you intend to make this a comment?

  3. #3
    Arthas_ss is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2012
    Location
    Jordan
    Posts
    5
    Reputation
    0
    Yes !! ..

  4. #4
    Dunfiddlin's Avatar
    Dunfiddlin is offline VB.NET Forum Master
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2012
    Posts
    253
    Reputation
    31
    Ok, turns out that you can't successfully bind the data source this way. If you bind it at design time using the report viewer smart tags, all this ....

    Con_Dia.Open()

    If Con_Dia.State = ConnectionState.Open Then

    DA = New OleDbDataAdapter("SELECT * FROM Information_Sheet", Con_Dia)
    If DA.Fill(DS, "Information_Sheet") > 0 Then
    DS.DataSetName = "xxx"
    Dim dt As New DataTable
    dt = DS.Tables(0)

    With Me.ReportViewer1.LocalReport
    .ReportPath = "c:\documents and settings\admin\my documents\visual studio 2010\Projects\WindowsApplication2\WindowsApplicati on2\Report1.rdlc"
    .DataSources.Clear()
    End With

    'rptDataSource = New ReportDataSource("luai", DS.Tables("Information_Sheet"))
    ReportViewer1.ProcessingMode = ProcessingMode.Local

    Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("xxx", DS.Tables("Information_Sheet")))


    End If





    End If
    Con_Dia.Close()
    ReportViewer1.RefreshReport()


    ... can then be replaced with this ...

    Me.ReportViewer1.RefreshReport()

  5. #5
    Arthas_ss is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2012
    Location
    Jordan
    Posts
    5
    Reputation
    0
    Ok .. thank you ..
    but i do not like to use smart tag .. i would like to pass dataset or datatable through behind code ..

    so " do i have to do something before i write this code ??? "

    thanks a lot ..


  6. #6
    Dunfiddlin's Avatar
    Dunfiddlin is offline VB.NET Forum Master
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2012
    Posts
    253
    Reputation
    31
    I'm afraid that as long as you stay in VB you don't get a choice but to use the smart tags. You can do this in code in ASP but not in VB.

  7. #7
    Arthas_ss is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2012
    Location
    Jordan
    Posts
    5
    Reputation
    0
    thank you man .. !!! i think this is what i was looking for ..

    " So .. there is no way but using (smart tags ) "

    now .. do i have to use "DataSet1.xsd" ???

  8. #8
    Dunfiddlin's Avatar
    Dunfiddlin is offline VB.NET Forum Master
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2012
    Posts
    253
    Reputation
    31
    Er ... why would you not?

  9. #9
    Arthas_ss is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2012
    Location
    Jordan
    Posts
    5
    Reputation
    0
    I did it .. but only with "XSD File "

    Thanks for your help ..

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking