-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckprod.aspx.cs
More file actions
55 lines (47 loc) · 1.51 KB
/
Copy pathCheckprod.aspx.cs
File metadata and controls
55 lines (47 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Checkprod : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (System.Web.HttpContext.Current.Session["Production"] as string == null)
{
Response.Redirect("Login.aspx");
}
}
protected void Button4_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=JOHN-PC;Initial Catalog=Skyminerals;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from Productivity where Op_code like'" + TextBox7.Text + "%'";
cmd.Connection = con;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView2.DataSource = ds;
GridView2.DataBind();
SqlDataReader dr;
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
GridView1.Visible = false;
GridView2.Visible = true;
Label18.Visible = false;
}
else
{
GridView1.Visible = false;
Response.Write("<script>alert('the search term is not available in the Records');</script>");
}
}
}