Monday, January 2, 2012

How to Clear all Text Boxes on button Click in web Application

 For Each c As Control In fr
            If c.ToString.Equals("System.Web.UI.WebControls.TextBox") Then
                CType(c, TextBox).Text = ""
            End If

            If c.ToString.Equals("System.Web.UI.WebControls.DropDownList") Then
                CType(c, DropDownList).ClearSelection()
            End If
        Next

What is Difference Between ExecuteReader, ExecuteScaller annd ExecuteNonQuery ?

ExecuteReader : Use for accessing data. It provides a forward-only, read-only, connected recordset.

ExecuteNonQuery : Use for data manipulation, such as Insert, Update, Delete.

ExecuteScalar : Use for retriving 1 row 1 col. value., i.e. Single value. eg: for retriving aggregate function. It is faster than other ways of retriving a single value from DB.

Saturday, September 17, 2011

Can we declare event and delegates in an interface ?

No,we cannot declare delegates in interface however we can declare events in interface.
So interface can only contains the signature of the following members
Methods
Properties
Indexers
Events