Quantcast
Viewing all 519 articles
Browse latest View live

How to Create Report Viewer Binding to Object in VB.NET

I have Class named "User", code:

     Public Class User

        Private m_id As String
        Private m_user_name As String

        Public Sub New(ByVal id As String, ByVal name As String, ByVal pwd As String)
          m_id = id
          m_user_name = name
          m_pwd = pwd
        End Sub

        Public Property Id() As String
          Get
              Return m_id
          End Get
          Set(ByVal value As String)
              m_id = value
          End Set
        End Property

        Public Property Name() As String
          Get
              Return m_user_name
          End Get
          Set(ByVal value As String)
              m_user_name = value
          End Set
        End Property

     End Class
And I want to report all the user's information, so I also have another class named "Users", code:


     Public Class Users
           inherits List(Of User)
           Public Sub New()
                  'Query users' information from Table in Database
                  Add(New User(...)
           End Sub
     End Class

When I clicked on "Print" button, it will pop up the report. I have only one Form with Report Viewer, but I have a lot of reports using this Form with Report Viewer. so I code like this:


     Public Class Form1
            Private Sub Form1_Load(...) Handles MyBase.Load

                Dim bs As New BindingSource
                bs.DataSource= New Users
                
                Dim rpt As New Microsoft.Reporting.WinForms.ReportDataSource
                rpt.Name = "Report_User"
                rpt.Value = bs
                ReportViewer1.LocalReport.DataSources.Add(rpt)
                ReportViewer1.LocalReport.ReportEmbeddedResource = rpt.Name
                ReportViewer1.RefreshReport()
            End Sub

But it doesn't show anything... Please help me... I really need your help..
Thanks in advance

Visual Studio 2012 compiling RDLC error while loading code module

Hello all,

I've developed an application on .net Framework 3.5 with VS 2010 and now I am trying to develop it with VS 2012.

I'm facing a problem with ReportViewer.

In my application, I'm using a specific .dll that is called by several local reports (.rdlc files). I dutifully copy the .dll in the Common 7\IDE\Private Assemblies directory, but  still cannot compile solution due to error:

"Error while loading code module: ‘Development.Tools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'Development.Tools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies."

Please help!

Visual Studio 2012 rdlc with external reference bug?

I'm using rdlc with external reference in my Application.
 
In Visual Studio 2010 I had to copy the dll into "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies" then it was possible to Build the application.
 
With the Visual Studio 2012 I tried with following directories:
 
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies

I allways get an error "the assembly couldn't be loaded" is it a bug or have I to copy my assembly in an another directory.
 
I'm trying to find a solution for a weeek.
 
Please help me.


Drill through report in Report Viewer

I am getting the following error when I click on the hyperlink in report1, and it should take me to report 2

A data source instance has not been supplied for the data source 'DataSet1_Order_Details'

 I have written the following code to handle the drill through event

 

  protected void ReportViewer1_Drillthrough(object sender, DrillthroughEventArgs e)
  {
    string orderid = e.Report.GetParameters()[0].Values[0].ToString().Trim();
    ObjectDataSource2.SelectParameters["OrderID"].DefaultValue = orderid;
    DataView dv = (DataView)ObjectDataSource2.Select();
    ReportDataSource rd = new ReportDataSource("DataSet1_Order_Details", orderid);
    rd.Value = dv;
    ReportViewer1.LocalReport.DataSources[0] = rd;
    ReportViewer1.DataBind();
  }

 Can you tell me where I am going wrong? I have a report parameter OrderID in the Report2. In the getdata method for the tabledapter for orderid I take the paramter. I am passing the paramter to the objectdatasource2 which I belive is for the getdata method of report2.

But still, it doesn't work!

Show Data-bound table in Page Header

Hello,

my situation is that I want to print a (same) table (which gets data from a dataset) on every page of a report. The table is on top of the page and followed by 4 charts per page. 

Unfortunately it is not possible to place data-bound controls (like tablix) into the page header-area. Here [http://msdn.microsoft.com/en-us/library/ms252093(VS.80).aspx ] I found this message:

You cannot add data-bound fields or images directly to a header or footer. However, you can write an expression that indirectly references a data-bound field or image that you want to use in a header or footer.

Has anyone done this? I tried to place textboxes in the body of the report, hide them, and show the value (via expression) in a textbox in the page header. That works. But with a table that has an infinite number of rows I have no successful solution.

Thank you.

Martin

What's wrong with this expression?

Hi,

One of the columns in my report contains the following value expression:

=IIF(System.Decimal.Compare(Fields!BalanceAmount.Value, System.Decimal.Parse("0.0M")) < 0,  string.Format("{0:N2}", Math.Abs(Fields!BalanceAmount.Value)) & " DR.", IIF(System.Decimal.Compare(Fields!BalanceAmount.Value, System.Decimal.Parse("0.0M")) > 0, string.Format("{0:N2}",  Fields!BalanceAmount.Value) & " CR.", "0.00"))

On running the report, the column however shows the value "#Error" in all the rows, and a following warning is written out on the Output window of Visual Studio:

Warning: The Value expression for the textrun ‘BalanceAmount.Paragraphs[0].TextRuns[0]’ contains an error: Input string was not in a correct format. (rsRuntimeErrorInExpression)

Could someone tell me what is wrong with the expression as the project compiles without any error? Also, is it allowed to insert a manual line break in the expression to make it more readable? Finally, I don't seem to find the good documentation for the report viewer.

Thanks in advance.

-Dinesh

LocalReport Error - A data source instance has not been supplied for the data source

I have just installed VS 2005 RC.

Tried using the LocalReport control using the exact sample code provided in the help for the Render method.

I keep getting an error during the LocalReport.Render method call - InnerException = "A data source instance has not been supplied for the data source". The dataset and table supplied is valid as it works with the Reportviewer control.

Is there something I am missing or is the sample code wrong?

How to write text inside reports in crystal reports

I want to write text inside the report vertically in crystall report.

The text should be write vertially inside of whole report,not a session like border of page.

Is this capable?



Adding data to report at runtime

Hello There,

I have a Windows application where i am making use of Report Viewer and Report (.rdlc) to display records fetched from the database. It works fine when i bind it to the dataset created during design time. For my application i need to make use of custom SQL Queries to fetch desired results from the database at runtime. I have been searching for a solution since the past one week but nothing seems to help. 

Display data in two column using reportviewer windows forms

Hello !

I want to display following data in same page.

For example ,

-------------------------------------------------------

|Rno     |    Name      |    Rno    |     Name   |

--------------------------------------------------------

1          |   abc           |    4        |     four      |

2          |   two          |     5        |    five       |

3          |   three       |     6        |   six          |

------------------------------------------------------

How can we display above output using report viewer ?


Mayur Dabhi

508 Compliance using ReportViewer and .rdlc

Hello,

I'm new to using .rdlc files and the ReportViewer control.  We have been tasked by our customer with a new requirement of making our web apps 508 compliant (things like using "alt" tags in the rendered html, etc.).  I've used a tool, AccVerify, to validated some reports as rendered in a browser and fail quite easily.  The biggest problem areas are any of the Menu and Paramter controls, which are automatically rendered from the design time property settings.

The problem is that .rdlc files are basically xml, so is there a way to update the xml files to include our own custom tags that are required for the 508?

Is there any other info available on how well ReportViewer and .rdlc files handle 508 compiance issues?

Reportviewer expression

I've been successfully using the WinForm ReportViewer control to view reports from relational databases.  I used expressions to do calculations on the rdlc file. I need to addition on two expressions  given below i.e parameteres and Formate number forms..

=Parameters!TotalScanStarInfo.Value    =FormatNumber(Sum(Fields!SelfScanStarAmount.Value,"SelfReferralDataSet")+Sum(Fields!HospitalScanStarAmount.Value,"HospitalReferralDataSet")+Sum(Fields!DoctorScanStarAmount.Value,"DoctorReferralDataSet") ,0)

Report Viewer Control Not Exporting Properly through Cisco VPN Gateway

I have a web page that uses the reportviewer control to display reports from a remote SSRS server. It is access through an HTTPS Cisco VPN gateway for security.

I have no trouble displaying the reports , and they seem to function fine, but the toolbar is missing Icons, and the export function uses the wrong URL to try to export - which causes a 404 error.

For Example, the Url to the report Page is:

SampleUrl.com/cvpn/wpFIPiL-2fGCePezuG28P_cLZg/bahn/Interfaces/AdminReports.aspx?ReportName=CLR

This works fine, but when I try to export the report, it uses the URL:

SampleUrl.com/BAHN/Reserved.ReportViewerWebControl.axd?ReportSession=f5vcte45kbsny3rcbydo34m3&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=78d4463cc8bd4cab8c99265c1bdc227f&OpType=Export&FileName=CallLogReport&ContentDisposition=OnlyHtmlInline&Format=PDF

-- It leaves out the cvpn/wpFIPiL-2fGCePezuG28P_cLZg section of the URL, and gets a 404 error.

If I manually add that section back into the URL, it gives me the export as normal.

Is there anyway to get the export working uring the proper URL?

Any help would be appreciated.

Jkahn6

IF conditions for fields in crystal reports

Hi,i have a report that has many fields from  a dataset on it.i want if a field's value is something then it shows something else on report.For example if the value of field is 4 then it shows Good instead of 4 on my report.i know i can use parameters and read data and put if and else to do that but I'm wondering if there is a easier way? (Guess i can do that with formulas but no idea how it can be done cuz never worked with formulas)

thanks.

Microsoft ReportViewer

I am having the following error: Overload resolution failed because no accesible 'New' is most specific for the arguements.

This is part of the code:

' show the correct report
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        ' remove previous report
        Me.Controls.Remove(RV)
        RV.Dispose()

        RV = New Microsoft.Reporting.WinForms.ReportViewer
        RV.Parent = GroupBox2
        RV.Dock = DockStyle.Fill
        RV.Visible = True


        ' check the first report
        If ComboBox1.Text = "Total profit for all time" Then

            ' fill the information for that report
            Dim TA As New POSDSTableAdapters.TotalProfitForAllTimeTableAdapter
            Dim TmpDS As New POSDS
            TA.Fill(TmpDS.TotalProfitForAllTime)

            ' clear previous DS
            RV.LocalReport.DataSources.Clear()

            ' create new DS
            Dim RDS As New Microsoft.Reporting.WinForms.ReportDataSource("POSDS_TotalProfitForAllTime", TmpDS.TotalProfitForAllTime)

            ' tell the report control to use the DS, and
            ' use the report template created by us.
            RV.LocalReport.DataSources.Add(RDS)
            RV.LocalReport.ReportEmbeddedResource = "POS.TotalProfitForAllTime.rdlc"
            RV.RefreshReport()

The problem is this line:

            Dim RDS As New Microsoft.Reporting.WinForms.ReportDataSource("POSDS_TotalProfitForAllTime", TmpDS.TotalProfitForAllTime)

This code works fine in 2008 but in vb2010 it shows the error.

I am busy working on a project. Is there a solution for this, please help.


SubReport in a web application error Data retrieval failed for the subreport

Hi,

I am trying to create a report in a web application. The report is supposed to have a sub report in it.

What I did was create 2 reports.

Report1 (Master Report)

Report2 (SubReport)

I added parameters to the reports. then I dropped a subreport control on the report1. and set its properties to reference to Report2.

I also set the parameter for the subreport.

But it gave me the error

Data retrieval failed for the subreport, 'Subreport1', located at:Path \Report2.rdlc. Please check the log files for more information.

The Code is below

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><asp:TextBox ID="TextBox1" runat="server">2</asp:TextBox><asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /><rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" 
            Font-Size="8pt" InteractiveDeviceInfos="(Collection)" 
            WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="636px" 
            Height="397px" style="margin-right: 0px"><LocalReport ReportPath="Report1.rdlc"><DataSources><rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" /><rsweb:ReportDataSource DataSourceId="ObjectDataSource2" Name="DataSet2" /></DataSources></LocalReport></rsweb:ReportViewer><asp:ObjectDataSource ID="ObjectDataSource2" runat="server" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
            TypeName="PRMSReports.PRMSReportsTableAdapters.ExpenditureViewTableAdapter"><SelectParameters><asp:ControlParameter ControlID="TextBox1" DefaultValue="2" Name="projectid" 
                    PropertyName="Text" Type="Int32" /></SelectParameters></asp:ObjectDataSource><asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            DeleteMethod="Delete" InsertMethod="Insert" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
            TypeName="PRMSReports.PRMSReportsTableAdapters.Project_ProfileTableAdapter" 
            UpdateMethod="Update"><DeleteParameters><asp:Parameter Name="Original_Project_ID" Type="Int32" /></DeleteParameters><InsertParameters><asp:Parameter Name="Project_Title" Type="String" /></InsertParameters><SelectParameters><asp:ControlParameter ControlID="TextBox1" DefaultValue="2" Name="projectid" 
                    PropertyName="Text" Type="Int32" /></SelectParameters><UpdateParameters><asp:Parameter Name="Project_Title" Type="String" /><asp:Parameter Name="Original_Project_ID" Type="Int32" /></UpdateParameters></asp:ObjectDataSource>

the code behind file has the following code

protected void Page_Load(object sender, EventArgs e)
        {
            ReportViewer1.LocalReport.SubreportProcessing += SetSubDataSource;
            //this.ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SubreportProcessingEventHandler);
            this.ReportViewer1.LocalReport.ShowDetailedSubreportMessages = true;
            this.ReportViewer1.LocalReport.Refresh();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string name = TextBox1.Text;
            ObjectDataSource1.SelectParameters["projectid"].DefaultValue = name;
            ObjectDataSource1.DataBind();
            ReportViewer1.LocalReport.SubreportProcessing += SetSubDataSource;
            this.ReportViewer1.LocalReport.Refresh();
        }

        protected void SetSubDataSource(object sender, SubreportProcessingEventArgs e)
        {
            int Per_ID = Convert.ToInt32(TextBox1.Text);
            ExpenditureViewTableAdapter dt1 = new ExpenditureViewTableAdapter();
            dynamic rds = new ReportDataSource();
            rds.Name = "DataSet2";
            rds.Value = dt1.GetData(Per_ID);
            e.DataSources.Add(rds);
        }

Please note that i am trying to do this in a web application and not a report project. Help Needed.

Thanks

me

Created  a new report, opene finished report in "Prin preview" and got 35 pagesof a single page report...What settings did I missed setting to have only 1 page displayed for printing??

the report definition has an invalid target namespace 'http://schemas.microsoft.sqlserver.reporting/2008/01/reportdefinition' which cannot be upgraded".

Hi All,

            I have Visual Studio 2010, and .net framework 4.0 installed on my development machine.    I also have SQL Server 2008 installed (which you indicate above does not affect the issue).

           When I create a new Report project in Visual Studio 2010, the RDLC file has a reference inside it to .../2008/01/.... that looks like this:

<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

I have tried this several times.  I have only built "loca" reports.  When I build on my local machine, the reports build and run just dandy.   But when I try to build them on our build server, running MSBUILD, the  build fails with:

the report definition has an invalid target namespace 'http://schemas.microsoft.sqlserver.reporting/2008/01/reportdefinition' which cannot be upgraded".

Im not sure why the new report didn't get created as /2010/, since everything I believe is using .net framework 4.0.       Any help greatly appreciated.

Regards,

Mike

 

 

Dynamic columns in crystal reports

Hi, i have some columns in my database like :id,bill,payed,date,period,...

i want to filter columns in dialogue box before showing the report,mean i want to put checkboxes in in a windows before showing report so user can select which columns to show in report. for example if user checkid and date checkboxes after he clicked print in report he must see 2 columns with id and date header. and i don't want long spaces between column so it must put columns in right places despite paper width.

thanks.

Filter on sql data source for parameters using like statement

Hi all, I have a Report Viewer that I am supplying a SQL statement with a LIKE statement in it, I am passing two parameters to it from another web page.  Everything works fine on it until I pass it the '%' wildcard...  when I run the SQL statement in SQL it runs fine and returns what I want, but not in the report.  If I pass it specific values then the report runs perfect, but for some reason it doesn't seem to like the wildcard??  Been trying to get this to work for a day now, but no luck...

Thanks for any help!!

Viewing all 519 articles
Browse latest View live


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