Ejemplo n.º 1
0
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     em.connect();
     em.cmd.CommandText = "select Eid,Ename from EmpTab";
     em.rs = em.cmd.ExecuteReader();
     if (em.rs.Read())
     {
         GridView1.DataSource = em.rs;
         GridView1.DataBind();
     }
     em.disconnect();
 }
Ejemplo n.º 2
0
 protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
 {
     s = Menu1.SelectedItem.Text;
     Response.Write(s);
     if (s.Equals("Stock Checking"))
     {
         pc.connect();
         pc.cmd.CommandText = "select pname,pqnty from producttable";
         pc.rs             = pc.cmd.ExecuteReader();
         GridView2.Visible = false;
         if (pc.rs.Read())
         {
             GridView1.DataSource = pc.rs;
             GridView1.DataBind();
         }
         pc.disconnect();
     }
     else if (s.Equals("Product Checking"))
     {
         pc.connect();
         pc.cmd.CommandText = "select * from producttable";
         pc.rs             = pc.cmd.ExecuteReader();
         GridView2.Visible = false;
         if (pc.rs.Read())
         {
             GridView1.DataSource = pc.rs;
             GridView1.DataBind();
         }
         pc.disconnect();
     }
     else
     {
         GridView2.Visible = true;
         em.connect();
         Response.Write("ZZZZZZ");
         em.cmd.CommandText = "select Eid,Ename from EmpTab";
         em.rs             = em.cmd.ExecuteReader();
         GridView1.Visible = false;
         while (em.rs.Read())
         {
             GridView1.DataSource = em.rs;
             GridView1.DataBind();
         }
         em.disconnect();
     }
 }
Ejemplo n.º 3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        em.connect();
        em.cmd.CommandText = "insert into EmpTab values(@i,@n,@e,@m,@s,@a,@d,@p)";
        em.cmd.Parameters.AddWithValue("@i", TextBox10.Text);
        str1 = TextBox1.Text;
        str2 = TextBox5.Text;
        str1 = str1 + " " + str2;
        em.cmd.Parameters.Add("@n", str1.ToString());
        em.cmd.Parameters.Add("@e", TextBox2.Text);
        em.cmd.Parameters.Add("@m", TextBox3.Text);
        em.cmd.Parameters.Add("@s", TextBox4.Text);
        em.cmd.Parameters.Add("@a", TextBox6.Text);
        em.cmd.Parameters.Add("@d", TextBox7.Text);
        em.cmd.Parameters.Add("@p", TextBox8.Text);

        em.cmd.ExecuteNonQuery();
        Response.Write("<script>alert('Data Stored Successfully')</script>");

        //em.cmd.CommandText = "delete * from EmpTab";

        em.disconnect();
    }
Ejemplo n.º 4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     em.connect();
     em.cmd.CommandText = "select * from EmpTab where Eid=@i";
     em.cmd.Parameters.Add("@i", TextBox1.Text);
     em.rs = em.cmd.ExecuteReader();
     if (em.rs.Read())
     {
         str1 = em.rs[7].ToString();
     }
     str2 = TextBox2.Text;
     // Response.Write(TextBox1.Text + "   " + TextBox2.Text);
     if (String.Equals(str1, str2) == true)
     {
         Response.Redirect("AttendanceChk.aspx");
     }
     else
     {
         Label4.Text   = "Ur username or password is wrong";
         TextBox1.Text = "";
         TextBox2.Text = "";
     }
     em.disconnect();
 }