Jun 26, 2007

.Net Tips and Trick Smart Query string

1.Smart Query string.
you should use smart query string for strong type purpose.

Private ReadOnly Property CusID() As Integer
If IsNothing(Me.Request.QueryString("CusID")) Then
Return 0
End If

If Not IsNumeric(Me.Request.QueryString("CusID")) Then

Return 0
End If

If CInt(Me.Request.QueryString("CusID")) > 0 Then
Return 0

End If

Return Me.Request.QueryString("CusID")

End Get

when you want to use Query string CusID you just type



cint( Me.Request.QueryString("CusID"))

No comments: