-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompanyViewMedicalInsuranceScheme.aspx.cs
72 lines (65 loc) · 2.1 KB
/
CompanyViewMedicalInsuranceScheme.aspx.cs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class CompanyViewMedicalInsuranceScheme : System.Web.UI.Page
{
SqlConnection con;
SqlCommand cmd;
SqlDataReader rs;
SqlDataAdapter adp;
DataTable dt;
void bindgrid()
{
adp = new SqlDataAdapter("select * from mstable where iid=@iid", con);
adp.SelectCommand.Parameters.AddWithValue("iid", TextBox1.Text);
dt = new DataTable();
adp.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
try
{
Label1.Text = "";
Menu m4 = (Menu)Master.FindControl("Menu4");
m4.Visible = true;
con = new SqlConnection(ConfigurationManager.ConnectionStrings["connection"].ConnectionString);
con.Open();
if (!IsPostBack)
{
if (Session["IID"] != null)
{
TextBox1.Text = Session["IID"].ToString();
cmd = new SqlCommand("select cname from itable where iid=@iid", con);
cmd.Parameters.AddWithValue("iid", TextBox1.Text);
rs = cmd.ExecuteReader();
if (rs.Read())
{
TextBox2.Text = rs["cname"].ToString();
rs.Close();
cmd.Dispose();
}
else
{
rs.Close();
cmd.Dispose();
Label1.Text = "Record Not Found.Check ITable.....";
return;
}
bindgrid();
}
}
}
catch (Exception ex)
{
Label1.Text = ex.Message;
}
}
}