Wednesday, 9 May 2012

Subquery in Sql .Example highest Sallary.







                                                            OR

SELECT        St1.Id, St1.Name, St2.Sallary
FROM            St1 INNER JOIN
                         St2 ON St1.Id = St2.Id
WHERE        (St2.Sallary =
                             (SELECT        MAX(Sallary) AS Expr1
                               FROM            St2 AS St2_1))

First Page Design

using

 First Page Coading
System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class RequestQUery : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
   
        Response.Redirect(string.Format("Requet.aspx?val={0}&sal={1}",TextBox1.Text,TextBox2.Text));
     
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("Requet.aspx?ef="+TextBox3.Text);
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        Server.Transfer("Requet.aspx?ff=" + TextBox4.Text);
    }
}
Second Page Design

Second Page Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Requet : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        TextBox1.Text = Request.QueryString["val"].ToString();
        TextBox2.Text = Request.QueryString["sal"].ToString();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox3.Text = Request.QueryString["ef"].ToString();
    }
    protected void Button3_Click(object sender, EventArgs e)
    {

        TextBox4.Text = Request.QueryString["ff"].ToString();
    }
}

No comments:

Post a Comment