Esempio n. 1
0
        public List <prpfixtures> Find_rec(Int32 id)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("findfixtures", con);

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

            if (dr.HasRows)
            {
                dr.Read();
                prpfixtures k = new prpfixtures();
                k.id    = Convert.ToInt32(dr[0]);
                k.team1 = dr[1].ToString();
                k.team2 = dr[2].ToString();
                k.venue = dr[3].ToString();
                k.date  = Convert.ToDateTime(dr[4]);
                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
Esempio n. 2
0
        public List <prpfixtures> Disp_Rec()
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("disfixtures", con);

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

            while (dr.Read())
            {
                prpfixtures k = new prpfixtures();
                k.id    = Convert.ToInt32(dr[0]);
                k.team1 = dr[1].ToString();
                k.team2 = dr[2].ToString();
                k.venue = dr[3].ToString();
                k.date  = Convert.ToDateTime(dr[4]);
                obj1.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj1);
        }
Esempio n. 3
0
        public void Del_rec(prpfixtures p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("delfixtures", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@id", SqlDbType.Int).Value = p.id;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
Esempio n. 4
0
        public void Save_Rec(prpfixtures p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }

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

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@team1", SqlDbType.VarChar, 50).Value = p.team1;
            cmd.Parameters.Add("@team2", SqlDbType.VarChar, 50).Value = p.team2;
            cmd.Parameters.Add("@venue", SqlDbType.VarChar, 50).Value = p.venue;
            cmd.Parameters.Add("@date", SqlDbType.DateTime).Value     = p.date;
            cmd.ExecuteNonQuery();
            con.Close();
            cmd.Dispose();
        }