public List <clstbsgsdataprp> find_rec_ctg_sgs(Int32 sgsdatactgid) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("find_tbsgsdata_ctg_sgs", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@sgsdatactgid", SqlDbType.Int).Value = sgsdatactgid; SqlDataReader dr = cmd.ExecuteReader(); List <clstbsgsdataprp> obj = new List <clstbsgsdataprp>(); while (dr.Read()) { clstbsgsdataprp k = new clstbsgsdataprp(); k.sgsid = Convert.ToInt32(dr[0]); k.sgstitle = dr[1].ToString(); k.sgsast = dr[2].ToString(); k.sgsdesc = dr[3].ToString(); k.sgslk = dr[4].ToString(); k.sgsdat = Convert.ToDateTime(dr[5].ToString()); k.sgsdatactgid = Convert.ToInt32(dr[6]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
public List <clstbsgsdataprp> disp_rec_previous_hits() { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("disp_rec_previous_hits", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List <clstbsgsdataprp> obj = new List <clstbsgsdataprp>(); while (dr.Read()) { clstbsgsdataprp k = new clstbsgsdataprp(); k.sgsid = Convert.ToInt32(dr[0]); k.sgstitle = dr[1].ToString(); k.sgsast = dr[2].ToString(); k.sgsdesc = dr[3].ToString(); k.sgslk = dr[4].ToString(); k.sgsdat = Convert.ToDateTime(dr[5].ToString()); k.sgsdatactgid = Convert.ToInt32(dr[6]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
public void del_rec(clstbsgsdataprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("del_tbsgsdata", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@sgsid", SqlDbType.Int).Value = p.sgsid; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }
public void save_rec(clstbsgsdataprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("ins_tbsgsdata", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@sgstitle", SqlDbType.VarChar, 20).Value = p.sgstitle; cmd.Parameters.Add("@sgsast", SqlDbType.VarChar, 50).Value = p.sgsast; cmd.Parameters.Add("@sgsdesc", SqlDbType.VarChar, 50).Value = p.sgsdesc; cmd.Parameters.Add("@sgslk", SqlDbType.VarChar, 100).Value = p.sgslk; cmd.Parameters.Add("@sgsdat", SqlDbType.DateTime).Value = p.sgsdat; cmd.Parameters.Add("@sgsdatactgid", SqlDbType.Int).Value = p.sgsdatactgid; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }