protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         string strFirstName = Request.QueryString["firstname"];
         string strLastName  = Request.QueryString["lastname"];
         string strDOB       = Request.QueryString["dob"];
         string strQryDupStudent;
         strQryDupStudent = "SELECT studentid,firstname,lastname,dob FROM student " +
                            "WHERE ((firstname='" + strFirstName + "' OR lastname='" + strLastName + "') " +
                            "OR(firstname='" + strLastName + "' OR lastname='" + strFirstName + "'))" +
                            "AND(dob='" + strDOB + "')";
         StudentDataSource.SelectCommand = strQryDupStudent;
         StudentDataSource.DataBind();
         dgStudent.DataBind();
     }
 }
Beispiel #2
0
    protected void btnBrowseSID_Click(object sender, EventArgs e)
    {
        tblEntryForm.Visible = false;
        string firstname = txtFirstName.Text.Trim();
        string lastname  = txtLastName.Text.Trim();

        if (!firstname.Length.Equals(0) || !lastname.Length.Equals(0))
        {
            StudentDataSource.SelectCommand = DetermineQuery(firstname, lastname);
        }
        else
        {
            StudentDataSource.SelectCommand = "SELECT s.studentid,s.firstname,s.lastname,s.dob,s.lastupdatetime,c.countryname " +
                                              "FROM student s,country c WHERE s.countryid=c.countryid ORDER BY s.lastupdatetime DESC";
        }
        StudentDataSource.DataBind();
        dgStudent.Visible = true;
    }