"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Showing posts with label Interview Questions. Show all posts
Showing posts with label Interview Questions. Show all posts

Friday, September 21, 2012

QUOTED_IDENTIFIER ON/OFF and ANSI_NULL ON/OFF

When create or alter SQL object like Stored Procedure, User Defined Function in Query Analyzer, it is created with following SQL commands prefixed and suffixed. What are these – QUOTED_IDENTIFIER ON/OFF and ANSI_NULL ON/OFF?


ANSI NULL ON/OFF:
This option specifies the setting for ANSI NULL comparisons. When this is on, any query that compares a value with a null returns a 0. When off, any query that compares a value with a null returns a null value.

QUOTED IDENTIFIER ON/OFF:
This options specifies the setting for usage of double quotation. When this is on, double quotation mark is used as part of the SQL Server identifier (object name). This can be useful in situations in which identifiers are also SQL Server reserved words.

If u had any trouble just ask, Happy to help u :) Stay Tune... Have a nice day... 'N happy Coding :)

Tuesday, February 14, 2012

Boxing-Unboxing Variables

Hi *.*,


Boxing-Unboxing Variables, its a common interview question.In our everyday programming we came across this.Anyway for the unknows, here it goes...



Boxing:    Boxing is process of converting valueType variable to Referance Type veriable at runtime.


Unboxing:    Unboxing is a process of converting referance type to value type variable at run time
Unboxing is an explicit operation.


What happened in backend.


Value type is stored in Stacks
Reference type is stored in Heap


So boxing.


Values shifted Stacks to Heap and vice versa.



If u had any trouble just ask, Happy to help u :) Stay Tune... Have a nice day... 'N happy Coding :)

Monday, September 12, 2011

Nested grid and findControl over child grid

Hi *.*,
Nested grid and findControl over child grid
Over here i have two gridview (GridView1,GridView2) and on 2nd grid  a linkbutton, onclick event i need to extract particular row data. that my need here its go.
 On HTML


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound">
            <Columns>
                <asp:TemplateField HeaderText="Project">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("PkID") %>'></asp:Label>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("StrName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Sub Task">
                    <ItemTemplate>
                        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" OnRowCommand="GridView2_RowCommand">
                            <Columns>
                                <asp:TemplateField HeaderText="Task Name">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("name") %>'></asp:Label>
                                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("pk") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Task Status">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="DropDownList1" runat="server">
                                            <asp:ListItem>Open</asp:ListItem>
                                            <asp:ListItem>Close</asp:ListItem>
                                            <asp:ListItem>Finish</asp:ListItem>
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select" CommandArgument="<%#((GridViewRow) Container).RowIndex %>">Update</asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <HeaderStyle BackColor="#CCCCFF" />
                        </asp:GridView>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <HeaderStyle BackColor="Maroon" ForeColor="#FFCC00" />
        </asp:GridView>
    </div>
    </form>
</body>
</html>

 
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            GridView1.DataSource = d("SELECT PkID, StrName, DateTimeStamp FROM T2");
            GridView1.DataBind();
        }
    }

    public SqlDataReader d(string _Query)
    {
        SqlCommand cmd = new SqlCommand(_Query, con());
         return cmd.ExecuteReader();

    }

    public SqlConnection  con()
    {
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionDemoString"].ToString());
        con.Open();
        return con;
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.DataRow)// Bind nested grid view with parent grid view
            {
                string _name = ((Label)e.Row.FindControl("Label3")).Text;
                GridView griedview2 = (GridView)e.Row.FindControl("GridView2");
                griedview2.DataSource = d("SELECT     pk, name, DrpDwn FROM         TBNAME where DrpDwn='" + _name + "'");
                griedview2.DataBind();
            }
        }
        catch (Exception)
        {
           
            throw;
        }
    }
    protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        GridView GridView2 = (GridView)sender;  //find nested grid view
        GridViewRow chrow = (GridViewRow)GridView2.Parent.Parent; // parent grid's row for find any control from parent grid view
        if (e.CommandName == "Select")
        {
            int index = Convert.ToInt32(e.CommandArgument); //use command argument for identify row with nested grid view

            int pid = Convert.ToInt32(((Label)GridView2.Rows[index].FindControl("Label4")).Text); // id from labe4 of nested grid view
            DropDownList childrop = ((DropDownList)GridView2.Rows[index].FindControl("DropDownList1")); // get dropdownlist box of nested grid view
            string status = childrop.SelectedItem.Text;
        }

Hope u guys got it....If any trouble message me. :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Friday, July 15, 2011

Some Interview Question

Hi,
Last day had an interview, a top class one i ever had. Here i'm sharing some among them.


1:what are the advantages of asynchronous web page programming

Answer:
A. asynchronous web page programming improves application''s efficiency

B. asynchronous web page programming reduces page rendering time


2: For what file types IIS passes request to aspnet_isapi.dll

Answer:
A.File types for which IIS passes request to aspnet_isapi.dll are
.aspx,.asmx etc

B.File types for which IIS does not passes request to aspnet_isapi.dll are
.jpeg .png ,.html etc


3.how to set the title of the page dynamically from Code behind in ASP.NET C#

Answer:
A.Page.Header.Title = "New Title";
can be used to set the title of the page dynamically from Code behind in ASP.NET C#.

4.What is meant by intelligent load balancing in web farm in ASP.NET

Answer:
By intelligent load balancing in web farm in ASP.NET we mean "always send a request from a given client to same server to which the first request from that client was sent".Note that in web farm a web application request load is shared by more than one server.

5.How to encrypt view state using web.config in ASP.NET

Answer:
To encrypt view state using web.config in ASP.NET use the tag
<pages viewStateEncryptionMode = "Always"/>


There are lot more stuff but i can't recollect all of them :(

Stay Tune...
Have a nice day... 'N happy Coding :)