Exemple #1
0
        public void DiemMo_Insert(DCKS_DIEMMO objDiemMo)
        {
            try
            {
                StringBuilder strCmd = new StringBuilder();
                strCmd.AppendFormat("INSERT INTO {0} ({1},{2},{3},{4},{5},{6},{7},{8})",
                                    "sde.DCKS_DIEMGOCMO",
                                    "IDMoQuang", "SHDiemMo", "KHDiemMo", "LoaiKS", "TenKhu", "STTDiemGoc", "KHDiemGoc", "SHAPE");
                strCmd.AppendFormat(" VALUES({0},'{1}','{2}','{3}',{4},{5},'{6}',{7})", objDiemMo.IDMoQuang, objDiemMo.SHDiemMo, objDiemMo.KHDiemMo, objDiemMo.LoaiKS, objDiemMo.TenKhu, objDiemMo.STTDiemGoc, objDiemMo.KHDiemGoc, objDiemMo.SHAPE);

                using (SqlConnection connection = new SqlConnection(strConnect))
                {
                    using (var cmd = new SqlCommand(strCmd.ToString(), connection))
                    {
                        try
                        {
                            connection.Open();
                            Int32 rowsAffected = cmd.ExecuteNonQuery();
                            connection.Close();
                        }
                        catch (Exception ex)
                        {
                            connection.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #2
0
 public void DiemMo_Delete(DCKS_DIEMMO objDiemMo)
 {
     try
     {
         StringBuilder strCmd = new StringBuilder();
         strCmd.AppendFormat("DELETE FROM {0} WHERE IDMoQuang={1}",
                             "sde.DCKS_DIEMGOCMO", objDiemMo.IDMoQuang);
         using (SqlConnection connection = new SqlConnection(strConnect))
         {
             using (var cmd = new SqlCommand(strCmd.ToString(), connection))
             {
                 try
                 {
                     connection.Open();
                     cmd.ExecuteNonQuery();
                     connection.Close();
                 }
                 catch (Exception ex)
                 {
                     connection.Close();
                 }
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Exemple #3
0
        public void DiemMo_Update(DCKS_DIEMMO objDiemMo)
        {
            try
            {
                StringBuilder strCmd = new StringBuilder();
                strCmd.AppendFormat("UPDATE {0} SET (IDMoQuang='{1}',SHDiemMo='{2}',KHDiemMo='{3}',LoaiKS={4},TenKhu={5},STTDiemGoc='{6}',KHDiemGoc={7},SHAPE={8})",
                                    "sde.DCKS_DIEMGOCMO",
                                    objDiemMo.IDMoQuang,
                                    objDiemMo.SHDiemMo,
                                    objDiemMo.KHDiemMo,
                                    objDiemMo.LoaiKS,
                                    objDiemMo.TenKhu,
                                    objDiemMo.STTDiemGoc,
                                    objDiemMo.KHDiemGoc,
                                    objDiemMo.SHAPE);
                strCmd.AppendFormat(" WHERE IDMoQuang = {1}", objDiemMo.IDMoQuang);

                using (SqlConnection connection = new SqlConnection(strConnect))
                {
                    using (var cmd = new SqlCommand(strCmd.ToString(), connection))
                    {
                        try
                        {
                            connection.Open();
                            Int32 rowsAffected = cmd.ExecuteNonQuery();
                            connection.Close();
                        }
                        catch (Exception ex)
                        {
                            connection.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }