No data on report

Arthas_ss

Member
Joined
Jun 20, 2012
Messages
5
Location
Jordan
Programming Experience
1-3
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\Marketing_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\WindowsApplication2\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
 
'rptDataSource = New ReportDataSource("luai", DS.Tables("Information_Sheet"))

Did you intend to make this a comment?
 
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()
 
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 ..

:welcoming:
 
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.
 
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" ???
 
Back
Top