Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //SqlConnection con = new SqlConnection("Data Source=asktoakhi.database.windows.net;Initial Catalog=asktoakhi;UID=asktoakhi;pwd=@K#!le47;Max Pool Size=100000;");
            SqlConnection  con = new SqlConnection("Data Source=.;database=jaspreet;integrated security=SSPI;");
            SqlCommand     cmd;
            SqlDataAdapter da = new SqlDataAdapter();
            DataTable      dt = new DataTable();

            try
            {
                con.Open();
                string Query = "SELECT * FROM jaspreet WHERE UserName =  '******'";
                cmd = new SqlCommand(Query, con);
                da.SelectCommand = cmd;
                da.Fill(dt);

                if (dt.Rows.Count > 0)
                {
                    GridProfile.DataSource = dt;
                    GridProfile.DataBind();
                }
                else
                {
                    Response.Write("<Script>alert('No Record Found.');</Script>");
                }
            }
            catch (Exception ex)
            {
                Response.Write("<Script>alert('" + ex.Message.ToString() + "');</Script>");
            }
            finally
            {
                con.Close();
            }
        }
Пример #2
0
 protected void AutoRefreshTimer_Tick(object sender, EventArgs e)
 {
     GridProfile.DataBind();
 }