using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MySql.Data.MySqlClient;
using System.Configuration;
using System.Web.Services;
using Newtonsoft.Json;
using System.Web.Script.Serialization;

public partial class module_Getintouch : System.Web.UI.Page
{
    public static string constring = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
    public static MySqlConnection con = new MySqlConnection(constring);
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    [WebMethod]
    public static string Getdata12(string srchyear)
    {
        string _data = "";
        {

            using (MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString))
            {

                if (con.State != ConnectionState.Open) { con.Open(); }
                using (MySqlCommand cmdpack = new MySqlCommand("SELECT sd.*, sd.uhid,sd.fname,sd.mname,sd.lname,sd.email,sd.mobile1,ay.year FROM student_detail AS sd LEFT JOIN academic_year AS ay ON sd.id=ay.id  WHERE ay.year='" + srchyear + "' ", con))
                {
                    using (MySqlDataAdapter sda29 = new MySqlDataAdapter(cmdpack))
                    {
                        DataTable dt29 = new DataTable();
                        sda29.Fill(dt29);
                        con.Close();

                        if (dt29.Rows.Count > 0)
                        {
                            _data = JsonConvert.SerializeObject(dt29);
                            return _data;
                        }

                    }
                }
            }

        }

        return _data;
    }
 
}