Posts

Viewstate vs Session

Image
Currently i am working on Web Application for which i had to perform some research on storing values in web application Which one is best to be used, As we all known HTTP Protocol is State less. Page can't hold variable [Value] on post back. So let see the working and difference Viewstate vs Session ViewState and Session are used to stored value Syntax  :  Viewstate (“ VariableName ”) = “ Value ”  :   Session (“ VariableName ”) =  “ Value ”                 1. ViewState are only accessible to page.                 i.e. Page1.aspx has Viewstate("Var1") Same will not be accessible in Page2.aspx.                        Instead once you call Viewstate("Var1") in page2.aspx it will create new Viewstate         ...

Part 2 C# Syntax for VB.net

Part 2 C# Syntax for VB.net 1).Any Collection value has to be accessed using index for example ArrayList MyArrayList[0].ToString(); All Index has to be accesses using Square brackets 2). Even Integer Variable Can't be used directly without assign values Int16 intValue; Int16 intloop; for (intLoop = 0; intLoop <= 5;intLoop ++) { intValue += intLoop; } This will give compile time error. for intValue is not assigned before using. Code has to be ----> Int16 intValue =0; 3.Intization of Value or Calls using constructor using System.Collections; ArrayList MyArrayList = new ArrayList(); DataEntry MyDEntry = new DataEntry(); 4.All methods will end with () Open And Close Brackets Example : intValue.ToString(); 5.Defining Properties string myStringValue; public string AccountName { get { return myStringValue; } set { mystringValue= value; } } WriteOnly Property public string my...

Part-1 C# Syntax For VB.net Developer

Part-1 C# Syntax For VB.net Developer             Started working on C# for a change. Found it to be more interesting and more challenging than conventional Basics Langauge. To get break from routine work i started developing sample  application on c#. I am enjoy this more and more. Felt some of the programming experience has to be shared.     While developing found there some of the syntax changed and way they are defined are also changed.     I have started series of C# Syntax for VB.net Developers which may help you people too.    To Concatenate String + sign has to be used VB.net uses & it has been replaced with + Sign in C# All Variable define must have default value string strSQL =""; int32 intNumber =0; Comment in C# Single Line Comment  // Muti Line Comment /* */ Define Subroutines private void DoSomething { } Define Fu...

Insert Constructors in SQL SERVER 2005 and 2008

Dear Developer,               Insert Constructors in SQL SERVER 2005 and 2008, This is new feature in 2005 and 2008. Which allow you pass multiple value statement into single insert Statement.         SQL :- SET IDENTITY_INSERT [dbo].[mastAssociatedWith] ON INSERT INTO [dbo].[mastAssociatedWith] (ID,[AssociatedWith]) VALUES (12,'Albert Rajan'), (15 ,'Amol Koparde'), (1 ,'Cmk'), (10 ,'Diwali'), (4 ,'For'), (14 ,'K. P. Rajeev'), (9 ,'Mer'), (5 ,'Obom'), (7 ,'Per'), (11 ,'Rajesh Sharma'), (3 ,'Rsk'), (6 ,'Sfk'), (13 ,'Sushil Kasar'), (2 ,'Vsk') SET IDENTITY_INSERT [dbo].[mastAssociatedWith] OFF   It has help me to perform task for import data from client database to my development database.    I was given task to import client data into development database.Data was given in text file. I had multiple choose to import data into SQ...

Class And Structure.

Dear Developers              I would like to share something which i found while performing one of the development task. Working difference between Class Objects and Structure Objects. If you see them they both are same in low level of the working. Classes has much more feature compared to Structures. The choose come when you have limit property and basis feature needed. Lets see the working Public Class Person     Dim strName As String     Public Property Name() As String         Get             Return strName         End Get         Set(ByVal value As String)             strName = value         End Set   ...

UNION ALL And Order BY

Dear Friends                       I have come across feature in SQL server which is less known to developers. Union ALL and Order by together. Fill combo box with union of two tables and order by Ascending. I would normally write it as   SQL :- Select  PersonName From (     Select PersonName From TranPersonDetails     Union All     Select CompanyName From TranCompanyDetails ) AllData Order by PersonName   Look into above SQL :- Additonal Select statment on top to add order by. Found easier way to provide order without Top Select Statement   SQL :- Select PersonName From TranPersonDetails Union All Select CompanyName From TranCompanyDetails Order By PersonName   No need to have additonal Select Statment. Order by will work for bo...

Count Line in Multiline Label Control

My New Task Count Total Number Lines in Label Control. Function LineCount(ByVal Label As Label) As Integer   Dim g As Graphics = Label.CreateGraphics     Dim LineHeight As Single = g.MeasureString("X", Label.Font).Height))   Dim TotalHeight As Single = g.MeasureString(Label.Text, Label.Font, Label.Width).Height     Return CInt(Math.Round(TotalHeight / LineHeight)) End Function