public void Update_Rec(prpcreate_team p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("updcreate_team", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tname", SqlDbType.VarChar, 50).Value = p.tname; cmd.Parameters.Add("@p1", SqlDbType.VarChar, 50).Value = p.p1; cmd.Parameters.Add("@p2", SqlDbType.VarChar, 50).Value = p.p2; cmd.Parameters.Add("@p3", SqlDbType.VarChar, 50).Value = p.p3; cmd.Parameters.Add("@p4", SqlDbType.VarChar, 50).Value = p.p4; cmd.Parameters.Add("@p5", SqlDbType.VarChar, 50).Value = p.p5; cmd.Parameters.Add("@p6", SqlDbType.VarChar, 50).Value = p.p6; cmd.Parameters.Add("@p7", SqlDbType.VarChar, 50).Value = p.p7; cmd.Parameters.Add("@p8", SqlDbType.VarChar, 50).Value = p.p8; cmd.Parameters.Add("@p9", SqlDbType.VarChar, 50).Value = p.p9; cmd.Parameters.Add("@p10", SqlDbType.VarChar, 50).Value = p.p10; cmd.Parameters.Add("@p11", SqlDbType.VarChar, 50).Value = p.p11; cmd.Parameters.Add("@time", SqlDbType.DateTime).Value = p.time; cmd.Parameters.Add("@score", SqlDbType.Float).Value = p.score; cmd.Parameters.Add("@captain", SqlDbType.VarChar, 50).Value = p.captain; cmd.Parameters.Add("@vice_captain", SqlDbType.VarChar, 50).Value = p.vice_captain; cmd.Parameters.Add("@team1", SqlDbType.VarChar, 50).Value = p.team1; cmd.Parameters.Add("@team2", SqlDbType.VarChar, 50).Value = p.team2; cmd.Parameters.Add("@id", SqlDbType.Int).Value = p.id; cmd.ExecuteNonQuery(); con.Close(); cmd.Dispose(); }
public void Del_rec(prpcreate_team p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delcreate_team", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@id", SqlDbType.Int).Value = p.id; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }
public List <prpcreate_team> Find_rec(Int32 id, Int32 fixid) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("findcreate_team", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@id", SqlDbType.Int).Value = id; SqlDataReader dr = cmd.ExecuteReader(); List <prpcreate_team> obj = new List <prpcreate_team>(); if (dr.HasRows) { dr.Read(); prpcreate_team k = new prpcreate_team(); k.id = Convert.ToInt32(dr[0]); k.tname = dr[1].ToString(); k.p1 = dr[2].ToString(); k.p2 = dr[3].ToString(); k.p3 = dr[4].ToString(); k.p4 = dr[5].ToString(); k.p5 = dr[6].ToString(); k.p6 = dr[7].ToString(); k.p7 = dr[8].ToString(); k.p8 = dr[9].ToString(); k.p9 = dr[10].ToString(); k.p10 = dr[11].ToString(); k.p11 = dr[12].ToString(); k.time = Convert.ToDateTime(dr[13]); k.score = Convert.ToSingle(dr[14]); k.captain = dr[15].ToString(); k.vice_captain = dr[16].ToString(); k.team1 = dr[17].ToString(); k.team2 = dr[18].ToString(); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
public List <prpcreate_team> Disp_Rec() { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("discreate_team", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List <prpcreate_team> obj1 = new List <prpcreate_team>(); while (dr.Read()) { prpcreate_team k = new prpcreate_team(); k.id = Convert.ToInt32(dr[0]); k.tname = dr[1].ToString(); k.p1 = dr[2].ToString(); k.p2 = dr[3].ToString(); k.p3 = dr[4].ToString(); k.p4 = dr[5].ToString(); k.p5 = dr[6].ToString(); k.p6 = dr[7].ToString(); k.p7 = dr[8].ToString(); k.p8 = dr[9].ToString(); k.p9 = dr[10].ToString(); k.p10 = dr[11].ToString(); k.p11 = dr[12].ToString(); k.time = Convert.ToDateTime(dr[13]); k.score = Convert.ToSingle(dr[14]); k.captain = dr[15].ToString(); k.vice_captain = dr[16].ToString(); k.team1 = dr[17].ToString(); k.team2 = dr[18].ToString(); obj1.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj1); }