Monday, July 28, 2008

How to format string to currency?

Use:
Public Function FormatCurrency(ByVal Expression As Object, Optional ByVal NumDigitsAfterDecimal As Integer = -1, Optional ByVal IncludeLeadingDigit As Microsoft.VisualBasic.TriState = UseDefault, Optional ByVal UseParensForNegativeNumbers As Microsoft.VisualBasic.TriState = UseDefault, Optional ByVal GroupDigits As Microsoft.VisualBasic.TriState = UseDefault) As String

Member of Microsoft.VisualBasic.Strings
-------------------------------
Examples:
Messagebox.show(Strings.FormatCurrency(str))

If the string is 7.75 the message box would show $7.75

Messagebox.show(Strings.FormatCurrency(str,4))

If the string is 7.75 the message box would show $7.7500

MessageBox.Show(Strings.FormatCurrency(str, 4, TriState.False))
If the string is 0.75 the message box would show $.7500

MessageBox.Show(Strings.FormatCurrency(str, 4, TriState.True))
If the string is 0.75 the message box would show $0.7500

Friday, July 25, 2008

Problem displaying a report in a web page?

Question:

I have Windows authentication for my Reporting Services and when I create a report for web [VS 2008 and Report Viewer Control] using back end data on my SQL Server RC0 and try displaying it, I get an error - the web page is not displayed?

Possible answer:

You need to make sure whether you have established a RC0 login for ASPNET which is usually \ASPNET. If it is not present then you can add it from the SQL Server Management Studio.

Monday, July 21, 2008

How to bind a DataSet to a DataGridView, a DataGrid?

A DataSet is memory resident data in DataTables in the DataTables collection. Each table is known by its name.

Let us say a DataTable named "MyTable" in a DataSet called "MyDs" needs to be bound to a DataGrid or a DataGridView controls. Then the following code does this binding:

DataGridView1.DataSource=MyDs.Tables("MyTable")




and for a Datagrid it will be,

DataGrid1.SetDataBinding(MyDs,"MyTable")

Sunday, July 13, 2008

What are the different Web site related reporting templates in Visual Studio 2008?

There are basically three ways reporting is supported in Visual Studio 2008.

These are,

ASP.NET Web Site -->You need to place a Microsoft Viewer Control for use in a reporting application

ASP.NET Reports web Site---->This type brings with it a .rdl file and starts a Report Design Wizard which needs configuring

ASP.NET Crystal Reports Web Site-->Hosts a default page with a Crystal Viewer Control and a Crystal Report that runs on the server.

Of course Visual Studio is another Interace for the BIDS project and provides three templates,

Report Server Project

Report Server Project Wizard

and Report Model Project

Wednesday, July 9, 2008

How are reports processed on a Report Server in SSRS 2008?

In SSRS 2008 reports are processed on the Report Server instance (not IIS) configured during installation and uses the two special relational databases as the backend, ReportServer and ReportServerTempdb.

Reports are procesed when they are requested by the user. These requests can take the following forms:

On-demand ->
User accessing report triggers report processor on the report server or, user working on a model-based report triggers report processor.

Demand for a cached report->
User accessing a cached copy triggers this type of processing if cached copy has expired.

From schedulig and delivery processor->
Schedules and delivery events trigger this type of processing.

In all these cases the published report definition file is retrieved. This file defines both data and formatiing information. The data from the data processing extension is merged with the formatting information to produce the report in an intermediate format. The rendering extension takes this report in the intermediate format, processes it and produces the report rendered in a device specific format. During this process it may also process information that were not processed earlier like expressions in the report.

In the case of report being requested due to user working with a model, the steps are similar except that the model is interrogated to provide report and model data.

In essence core processors, the several specialized extensions, and the backend work together to produce a finished report.