Example #1
0
        public List <clstbsgsctgprp> disp_rec()
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("disp_tbsgsctg", con);

            cmd.CommandType = CommandType.StoredProcedure;

            SqlDataReader         dr  = cmd.ExecuteReader();
            List <clstbsgsctgprp> obj = new List <clstbsgsctgprp>();

            while (dr.Read())
            {
                clstbsgsctgprp k = new clstbsgsctgprp();
                k.sgsctgid   = Convert.ToInt32(dr[0]);
                k.sgsctgnm   = dr[1].ToString();
                k.sgsctgdesc = dr[2].ToString();
                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
Example #2
0
        public List <clstbsgsctgprp> find_rec(Int32 sgsctgid)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("find_tbsgsctg", con);

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

            if (dr.HasRows)
            {
                dr.Read();
                clstbsgsctgprp k = new clstbsgsctgprp();
                k.sgsctgid   = Convert.ToInt32(dr[0]);
                k.sgsctgnm   = dr[1].ToString();
                k.sgsctgdesc = dr[2].ToString();
                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
Example #3
0
        public void del_rec(clstbsgsctgprp p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("del_tbsgsctg", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@sgsctgid", SqlDbType.Int).Value = p.sgsctgid;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
Example #4
0
        public void save_rec(clstbsgsctgprp p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("ins_tbsgsctg", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@sgsctgnm", SqlDbType.VarChar, 50).Value = p.sgsctgnm;

            cmd.Parameters.Add("@sgsctgdesc", SqlDbType.VarChar, 100).Value = p.sgsctgdesc;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }