public List <clsappprp> App(Int32 cod) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("disapp", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@cod", SqlDbType.Int).Value = cod; SqlDataReader dr = cmd.ExecuteReader(); List <clsappprp> obj = new List <clsappprp>(); while (dr.Read()) { clsappprp k = new clsappprp(); k.appcod = Convert.ToInt32(dr[0]); k.apphed = dr[1].ToString(); k.appdis = dr[2].ToString(); k.appdis1 = dr[3].ToString(); k.appdis2 = dr[4].ToString(); k.appimg = dr[5].ToString(); k.appcat = dr[6].ToString(); k.appdate = Convert.ToDateTime(dr[7]); k.appautcod = Convert.ToInt32(dr[8]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
public void Sub_App(clsappprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insapp", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@cod", SqlDbType.Int).Value = p.appcod; cmd.Parameters.Add("@hed", SqlDbType.VarChar).Value = p.apphed; cmd.Parameters.Add("@dis", SqlDbType.NVarChar).Value = p.appdis; cmd.Parameters.Add("@dis1", SqlDbType.VarChar).Value = p.appdis1; cmd.Parameters.Add("@dis2", SqlDbType.VarChar).Value = p.appdis2; cmd.Parameters.Add("@img", SqlDbType.VarChar).Value = p.appimg; cmd.Parameters.Add("@simg", SqlDbType.VarChar).Value = p.appsimg; cmd.Parameters.Add("@cat", SqlDbType.VarChar).Value = p.appcat; cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = p.appdate; cmd.Parameters.Add("@aut", SqlDbType.Int).Value = p.appautcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }