Example #1
0
        public HT_Du_An_Chi_Tiet Lay(string Ma_Du_An)
        {
            using (SqlConnection myConnection = new SqlConnection(ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("HT_Du_An_Lay", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;

                    SqlParameter pMa_Du_An = new SqlParameter("@Ma_Du_An", SqlDbType.VarChar, 2);
                    pMa_Du_An.Value = Ma_Du_An;
                    myCommand.Parameters.Add(pMa_Du_An);

                    SqlParameter pTen_Du_An = new SqlParameter("@Ten_Du_An", SqlDbType.NVarChar, 200);
                    pTen_Du_An.Direction = ParameterDirection.Output;
                    myCommand.Parameters.Add(pTen_Du_An);

                    SqlParameter pSTT = new SqlParameter("@STT", SqlDbType.Int, 4);
                    pSTT.Direction = ParameterDirection.Output;
                    myCommand.Parameters.Add(pSTT);


                    myConnection.Open();
                    myCommand.ExecuteNonQuery();


                    HT_Du_An_Chi_Tiet myHT_Du_An_Chi_Tiet = new HT_Du_An_Chi_Tiet();
                    myHT_Du_An_Chi_Tiet.Ma_Du_An  = Ma_Du_An;
                    myHT_Du_An_Chi_Tiet.Ten_Du_An = (string)pTen_Du_An.Value;
                    myHT_Du_An_Chi_Tiet.STT       = (int)pSTT.Value;
                    return(myHT_Du_An_Chi_Tiet);
                }
            }
        }
Example #2
0
        public void Cap_Nhat(HT_Du_An_Chi_Tiet myHT_Du_An_Chi_Tiet)
        {
            using (SqlConnection myConnection = new SqlConnection(ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("HT_Du_An_Cap_Nhat", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;

                    SqlParameter pMa_Du_An = new SqlParameter("@Ma_Du_An", SqlDbType.VarChar, 2);
                    pMa_Du_An.Value = myHT_Du_An_Chi_Tiet.Ma_Du_An;
                    myCommand.Parameters.Add(pMa_Du_An);

                    SqlParameter pTen_Du_An = new SqlParameter("@Ten_Du_An", SqlDbType.NVarChar, 200);
                    pTen_Du_An.Value = myHT_Du_An_Chi_Tiet.Ten_Du_An;
                    myCommand.Parameters.Add(pTen_Du_An);

                    SqlParameter pSTT = new SqlParameter("@STT", SqlDbType.Int, 4);
                    pSTT.Value = myHT_Du_An_Chi_Tiet.STT;
                    myCommand.Parameters.Add(pSTT);


                    myConnection.Open();
                    myCommand.ExecuteNonQuery();
                }
            }
        }