Beispiel #1
0
        //-------------------------------------------------------------------------------------------------------------------------------------------------
        public SortedDictionary <int, employee> dataemp()
        {
            SqlConnection con1 = new SqlConnection("Data Source =.; Initial Catalog = DSProject; Integrated Security = True");

            con1.Open();
            SqlDataAdapter read = new SqlDataAdapter("select * from employees ", con1);
            DataTable      dt   = new DataTable();

            read.Fill(dt);

            foreach (DataRow dr in dt.Rows)
            {
                employee zft = new employee();
                zft.name          = dr["name"].ToString();
                zft.Academic_year = (int)dr["Academic_year"];
                zft.password      = (int)dr["_password"];
                emp.Add((int)dr["ID"], zft);
            }

            con1.Close();
            return(emp);
        }