Exemple #1
0
        public int Update(Color1Info oParam)
        {
            string sql = @"UPDATE Color1 SET 
                            Color1ID=@Color1ID, 
                            Color1Name=@Color1Name, Status=@Status
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramColor1ID = new SqlParameter("@Color1ID", SqlDbType.NVarChar, 20);
            SqlParameter paramColor1Name = new SqlParameter("@Color1Name", SqlDbType.NVarChar, 200);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

            paramSysNo.Value = oParam.SysNo;
            paramColor1ID.Value = oParam.Color1ID;
            paramColor1Name.Value = oParam.Color1Name;
            paramStatus.Value = oParam.Status;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramColor1ID);
            cmd.Parameters.Add(paramColor1Name);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Exemple #2
0
        public int Insert(Color1Info oParam)
        {
            string sql = @"INSERT INTO Color1
                            (
                            SysNo, Color1ID, Color1Name, Status
                            )
                            VALUES (
                            @SysNo, @Color1ID, @Color1Name, @Status
                            )";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramColor1ID = new SqlParameter("@Color1ID", SqlDbType.NVarChar, 20);
            SqlParameter paramColor1Name = new SqlParameter("@Color1Name", SqlDbType.NVarChar, 200);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

            paramSysNo.Value = oParam.SysNo;
            paramColor1ID.Value = oParam.Color1ID;
            paramColor1Name.Value = oParam.Color1Name;
            paramStatus.Value = oParam.Status;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramColor1ID);
            cmd.Parameters.Add(paramColor1Name);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }