Thursday 24 May 2012

Adding Two text box value and redirecting it to third text box value

In design Page


 <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:TextBox ID="TextBox2" runat="server" OnTextChanged="text2_changed" AutoPostBack="true"></asp:TextBox>
        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
    </div>
    </form>

In code behind


    protected void text2_changed(object sender, EventArgs e)
    {
        try
        {

            int x = Convert.ToInt32(TextBox1.Text);
            int y = Convert.ToInt32(TextBox2.Text);

            int z = x + y;

            TextBox3.Text = z.ToString();
        }
        catch (Exception ex)
        {
            Label1.Text = "There seems to be an Exception.  !!" + ex.ToString();
        }
    }





Wednesday 2 May 2012

format for inner join SQL query

select columns
from table t1
inner join table t2 on t1.column1 = t2.column2
inner join table t3 on t1.column1 = t2.column2
where condition


example:

"Select a.ENTITYCODE,QUERYTYPEAFFID,b.tpaname,REQUESTTYPE,STATUS,QUERYTYPE from  STATUS_QUERY_TYPE_AFF a LEFT OUTER JOIN mastertpa b ON a.ENTITYCODE = b.TPACODE where a.ENTITYCODE=?"