Beispiel #1
0
        public bool DeleteChucVu(ChucVu cv)
        {
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("delete from chucvu where id=@id", con);

            cmd.Parameters.AddWithValue("@id", cv.CVid);
            cmd.ExecuteNonQuery();
            con.Close();
            return(true);
        }
Beispiel #2
0
        public void UpdateChucVu(ChucVu cv)
        {
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("update chucvu set name=@name where id=@id", con);

            cmd.Parameters.AddWithValue("@id", cv.CVid);
            cmd.Parameters.AddWithValue("@name", cv.CVname);
            cmd.ExecuteNonQuery();
            con.Close();
        }
Beispiel #3
0
        public DataSet FindChucVu(ChucVu cv)
        {
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("select * from chucvu where name like N'%@name%'", con);

            cmd.Parameters.AddWithValue("@name", cv.CVname);
            SqlDataAdapter sda = new SqlDataAdapter();
            DataSet        ds  = new DataSet();

            sda.Fill(ds);
            cmd.ExecuteNonQuery();
            con.Close();
            return(ds);
        }
Beispiel #4
0
        public string AddChucVu(ChucVu cv)
        {
            string        Message;
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("insert into chucvu (name) values (@name)", con);

            cmd.Parameters.AddWithValue("@name", cv.CVname);
            int result = cmd.ExecuteNonQuery();

            if (result == 1)
            {
                Message = cv.CVname + "them thanh cong";
            }
            else
            {
                Message = cv.CVname + "them khong thanh cong";
            }
            con.Close();
            return(Message);
        }