• Home
  • About
  • Resume

Posts tagged: Microsoft

Using FusionCharts in SSRS reports

By , 01/30/2017 12:11 PM

Microsoft’s SSRS is pretty advanced reporting system with multitude of advanced features. SSRS also has charting capabilities, but it’s somewhat lacking compared to more advanced desktop or web charting suites

On the other hand FusionCharts offers very cool charting package with gazillion of chart types and very cool features. But it uses JavaScript engine and renders charts client-side only!

What if there was a way to marry the two technologies together – to render cool FusionCharts in advanced SSRS repots? Continue reading 'Using FusionCharts in SSRS reports'»

SSRS and HTML rendering of ordered list

By , 11/14/2016 2:02 PM

Microsoft’s SQL Server Reporting Services supports rendering of HTML tags, but for some reason that support stuck in 1990s – only very limited set is supported. And even using that set is problematic.

Case in point – ordered list. While officially supported – the way it is rendered is the stuff nightmares are made off. Jumble of original tags generously intermixed with DIVs and SPANs – it’s a wonder it renders at all.

And sometimes it doesn’t. If you try to view a report in Internet Explorer (especially from older, but still actively used versions of SSRS like 2008) numbering get screwed.
Continue reading 'SSRS and HTML rendering of ordered list'»

[Video] Cancel long running SQL Command in ASP.NET WebForm application

By , 04/01/2016 9:50 AM

A while back I wrote an article on how to Cancel long running SQL Command in ASP.NET WebForm application

Webucator ASP.NET training was kind enough to turn it into video-lesson. Enjoy!

TSQL ISNUMERIC and “String or binary data would be truncated” error

By , 02/17/2016 12:34 PM

If you’re using TSQL ISNUMERIC function in a query, e.g.


You may receive unexpected error:

String or binary data would be truncated.

ISNUMERIC must truncate string data, and if you experienced the above error, some of your data is over the limit. But you can augment the above query:


But cutting only 8000 chars you will avoid the error, and I seriously doubt you will have number over 8000 digits long so it’s a safe bet as well

Solution: Windows 10: Unable to start Appstore apps

By , 08/05/2015 1:45 PM

Ok, I went ahead and upgraded to Windows 10. everything went smoothly, all my settings and installed apps preserved and work without a hitch. I am loving the interface and getting along with Cortana pretty good.

But after a while I encountered a weird issue: Appstore installed apps – e.g. Calendar, Mail etc. even Windows AppStore itself wouldn’t launch. I’d either get a cryptic error message, something along the lines “Application did not start, please contact system administrator” or very briefly a window would appear and immediately closed.

Looking into Event log was a bit more explanatory, but not too much: “Microsoft.WindowsStore_8wekyb3d8bbwe!App failed with error: Access is denied. See the Microsoft-Windows-TWinUI/Operational log for additional information.

If you google it – you will find many possible explanations of the problem and many possible ways to solve it offered, but none of those worked for me. Finally I figured it out (and Event Log entry gave me a clue): C:\Program Files\WindowsApps folder was missing necessary permissions:


Namely, “ALL APPLICATION PACKAGES” was missing read & execute permissions on that folder (had to to uncheck “Hide protected operating system files” in Control Panel, File Explorer options to be able to see it). Once I added correct permissions – appstore apps started launching with no problems.

Cancel long running SQL Command in ASP.NET WebForm application

By , 04/14/2015 3:03 PM

It’s an all too common scenario when your ASP.NET page takes too long to load and the culprit is slow, long running SQL query. It shouldn’t come to this, you should optimize your DB stuff to minimize delays, but if you’re trying to decode feline genome or find alien live in the neighboring galaxies – that’s unavoidable. So the page is running and at some point you decide enough is enough and decide you need to cancel it. But you want to do it gracefully, for example slow page is in an IFRAME and you want to remain in the parent page and you don’t want to close/reload the whole thing.

There’s a way. The idea is, every time you create an SqlCommand – you add it to static (shared in VB.NET) list. If command runs successfully – you remove it from the list. But if it takes too long – you can issue an AJAX call from client page to cancel the command stored in that list.

Thanks Arsalan Tamiz for posting this solution to my question on StackOverflow. His demo project was in C# (you can download it from the above link). but since most of my projects are in VB.NET – I did a conversion with some adjustments.
Continue reading 'Cancel long running SQL Command in ASP.NET WebForm application'»

ASP.NET WebForms: Safe refresh after postback

By , 02/10/2015 6:36 PM

It’s all too commons scenario in a Web Application, you initiate a postback by clicking a button (basically submitting a form), some action is performed, perhaps database is written to, all fine and good. And then you refresh the page. Or even page is refreshed for some purpose by a client-side JavaScript code. And the dreaded “resubmit” message appears, it differs from browser to browser, e.g. Firefox would say

“To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier”

And if you agree – the form is resubmitted again along with all the actions performed – not good.

This issue happens because the page is submitted via POST request and in order to refresh the page – POST request has to be resubmitted along with form action. And the solution is Post/Redirect/Get pattern. The idea is to take the page submitted via POST request and convert it into GET. In ASP.NET this can be achieved via simple Response.Redirect. You can redirect to another page or you can reload your current one:


This code redirects to original page URL, essentially reloading the from page server side. But now it’s a GET page, safe to refresh

Access nested controls in ASP.NET Page PreInit event (when no Master Page is involved)

By , 11/07/2014 4:34 PM

There’re situations when you need access ASP.NET web controls very early in page lifecycle, more specifically – in Page PreInit event – and you can, but only top-level controls. But what if you need to access child/nested controls? The example below uses Infragistics WebHierarchicalDataGrid as a child of Infragistics WebSplitter, but this pretty much applies to any such scenario.

Let’s say you have following layout

<ig:WebSplitter ID="WSP" runat="server">
      <ig:SplitterPane runat="server">

            <ig:WebHierarchicalDataGrid ID="WHG" runat="server">

      <ig:SplitterPane runat="server"></ig:SplitterPane>

As you can see grid “WHG” is nested withing first pane of splittet “WSP. Let’s see what happens if you try access the controls in PagePreInit event: Continue reading 'Access nested controls in ASP.NET Page PreInit event (when no Master Page is involved)'»

Microsoft Skype Doesn’t support IE11

By , 05/21/2014 8:39 AM

Ever since I upgraded to IE11 my Skype is throwing error

Skype IE11 error

Digging deeper – the error is throwing while Skype is attempting to display an ad banner

Skype ad banner error

So not only when Skype came into Microsoft possession it stated to display banner ads – in doing so it relies on Internet Explorer and it’s not compatible with the latest version.

How stupid is that?

Solution for SqlDataReader.ReadColumnHeader NullReferenceException

By , 08/30/2013 10:38 AM

This post related to the previous one, but I decided to write a separate article because it seems to be a common problem.

Sometimes when you use SqlDataReader, you would get an exception:

NullReferenceException {“Object reference not set to an instance of an object.”}
at System.Data.SqlClient.SqlDataReader.ReadColumnHeader(Int32 i)
at System.Data.SqlClient.SqlDataReader.ReadColumn(Int32 i, Boolean setTimeout)
at System.Data.SqlClient.SqlDataReader.GetInt32(Int32 i)

And the maddening thing – it doesn’t happen often, just every once in a while. And it happens at different times too, sometimes reader would read 100 records, sometimes 200 etc.

One possible case – SqlDataReader is losing its connection. And one possible reason for that – connection goes out of scope.

Consider following scenario – you have a function that returns SqlDataReader:

Function GetTheReader() as SqlDataReader
   Dim oConn As New SqlConnection("Connection String") : oConn.Open()
   Dim oComm As New SqlCommand("Stored Procedure", oConn)

   Dim oReader As SqlDataReader = oComm.ExecuteReader(CommandBehavior.CloseConnection)

   Return oReader
End Function

And you use it like this:

Dim oReader as SqlDataReader = GetTheReader()
'Begin use reader - loop, read data etc.

The problem with this approach that connection used to create the reader is stored in a private variable inside of `GetTheReader` function and when the function exits – the variable goes out of scope. Eventually, sooner or later Garbage Collector will collect it and close and dispose of connection – and at this time your SqlDataReader will fail.

The solution? Either use SqlDataReader at the same scope level you created it, or, if you do need to use function – pass connection object into it as one of the parameters, so it would remain valid after function exits.

Panorama Theme by Themocracy