problem in connection string

Jan 3 2012 6:59 AM
public New_Employee_Detail()
        {
            InitializeComponent();
            str2 = Update.Text;
            con = new OleDbConnection(@"Data Source=COMP5\SQLEXPRESS;Initial Catalog=TNTDB;Integrated Security=True");
            con.Open();
            dept_text1.Items.Clear();
            string OleDb;
            if (GlobalClass.EmpID == "admin")
            {
                OleDb = "SELECT EmpID FROM EmployeeDetails WHERE status IS NULL";
            }
            else
            {
                OleDb = "SELECT EmpID FROM EmployeeDetails WHERE EmpID NOT IN('HR001') And status IS NULL";
            }

            OleDbCommand1 = new OleDbCommand(OleDb, con);
            OleDbDataReader dr = OleDbCommand1.ExecuteReader();
            while (dr.Read())
            {
                dept_text1.Items.Add(dr[0]);
                count++;
            }

            dr.Close();
        }

Answers (3)