Monday, 10 June 2013

Synchronizing Internet Explorer favorites across different devices and different browsers easily

Surprisingly enough using Apple iCloud desktop is the easiest way to do so.



Custom SQL exceptions (error messages) to end users

Protected Sub FormView_Paper_ItemInserted(sender As Object, e As FormViewInsertedEventArgs) Handles FormView_Paper.ItemInserted
       
    If Not IsNothing(e.Exception) Then
            Dim DoDisplayCustomError As Boolean = False

            Dim SQLError As System.Data.SqlClient.SqlException
            If e.Exception.Source = ".Net SqlClient Data Provider" Then
                SQLError = DirectCast(e.Exception, SqlException)
                If SQLError.ErrorCode = -2146232060 Then
                    DoDisplayCustomError = True
                    ' Develop ur message display function!
                    Me.CurrentMasterPage.DisplayError("Missing Mandatory fields", "Fill in all mandatory fields.")
                End If
            End If

            If Not DoDisplayCustomError Then
                Me.CurrentMasterPage.DisplayError(e.Exception)
            End If
            e.ExceptionHandled = True
            e.KeepInInsertMode = True
        Else
            Response.Redirect("OtherPage.aspx")
        End If
    End Sub

Maintain FormView values on validation errors

Protected Sub FormView_Paper_ItemInserted(sender As Object, e As FormViewInsertedEventArgs) Handles FormView_Paper.ItemInserted

If Not IsNothing(e.Exception) Then
   
    e.ExceptionHandled = True
    e.KeepInInsertMode = True

End If

End Sub

Sunday, 9 June 2013

Generating a sequence of numbers using SQL Select statement

SELECT (Tens.N + Units.N) NN
FROM
(
SELECT 0 N
UNION SELECT 1 N
UNION SELECT 2 N
UNION SELECT 3 N
UNION SELECT 4 N
UNION SELECT 5 N
UNION SELECT 6 N
UNION SELECT 7 N
UNION SELECT 8 N
UNION SELECT 9 N
)Units
CROSS JOIN
(
SELECT 0 N
UNION SELECT 10 N
--UNION SELECT 20 N
--UNION SELECT 30 N
--UNION SELECT 40 N
--UNION SELECT 50 N
--UNION SELECT 60 N
--UNION SELECT 70 N
--UNION SELECT 80 N
--UNION SELECT 90 N
)Tens

-----
NN
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

Thanks for:
http://sqlmag.com/t-sql/generating-sequences-t-sql

Saturday, 8 June 2013

Feature I would like to see in: my mobile device

Token generator application for accessing the corporate VPN network, rather than having to hold another piece of H\W with me everywhere just for this purpose!!

Wednesday, 5 June 2013

SQL: Get aggregates for multiple values from the same table

Table Doc

ID Version
--  --
1  1
1  2
1  3*
2  1
2  2*
3  1
3  2*
4  1
4  2
4  3
4  4*
5  1*

To get maximum versions for each document

SELECT D.ID, D.Version
FROM Doc D 
INNER JOIN (SELECT ID, MAX(Version) FROM Doc GROUP BY ID) DM ON D.ID = DM.ID



Thanks Dinos for the inspiration!



Tuesday, 4 June 2013

Apple TV 2nd Gen: Sleep Now!

Press the middle (Select) button in the remote for 5 seconds.

SSRS Error: The EnableHyperlinks property has not been set for this report



    An error occurred during local report processing.
    • Report 'x' contains hyperlinks. The EnableHyperlinks property has not been set for this report
    •  


Report Viewer Properties: