예제 #1
0
        public List <prpteam> Find_rec(Int32 id)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("findteam", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@id", SqlDbType.Int).Value = id;
            SqlDataReader  dr  = cmd.ExecuteReader();
            List <prpteam> obj = new List <prpteam>();

            if (dr.HasRows)
            {
                dr.Read();
                prpteam k = new prpteam();
                k.id    = Convert.ToInt32(dr[0]);
                k.tname = dr[1].ToString();
                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
예제 #2
0
        public void Del_rec(prpteam p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("delteam", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@id", SqlDbType.Int).Value = p.id;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
예제 #3
0
        public void Save_Rec(prpteam p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }

            SqlCommand cmd = new SqlCommand("insteam", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@tname", SqlDbType.VarChar, 50).Value = p.tname;
            cmd.ExecuteNonQuery();
            con.Close();
            cmd.Dispose();
        }
예제 #4
0
        public List <prpteam> Disp_Rec()
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("disteam", con);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader  dr   = cmd.ExecuteReader();
            List <prpteam> obj1 = new List <prpteam>();

            while (dr.Read())
            {
                prpteam k = new prpteam();
                k.id    = Convert.ToInt32(dr[0]);
                k.tname = dr[1].ToString();
                obj1.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj1);
        }