{"id":695,"date":"2026-10-23T12:55:45","date_gmt":"2026-10-23T02:55:45","guid":{"rendered":"https:\/\/www.desiderata.com.au\/blog\/?p=695"},"modified":"2026-10-23T12:55:45","modified_gmt":"2026-10-23T02:55:45","slug":"a-delphi-tclientdataset-gotcha-key-violation-error-when-using-master-detail-datasets","status":"publish","type":"post","link":"https:\/\/www.desiderata.com.au\/blog\/?p=695","title":{"rendered":"A Delphi TClientDataset gotcha &#8211; key violation error when using master-detail datasets"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">If you create a TClientDataset and make it a detail dataset of a master-detail link by setting its master properties, when you run your app and navigate through the Master dataset, the default settings will create a Key Violation error.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is easily remedied by setting your detail TClientDataset.packetRecords to -1.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For some reason, every time you make a change to the master properties of this dataset, Delphi reverts the packetRecords back to zero which will cause the key violations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you create a TClientDataset and make it a detail dataset of a master-detail link by setting its master properties, when you run your app and navigate through the Master dataset, the default settings will create a Key Violation error. &hellip; <a href=\"https:\/\/www.desiderata.com.au\/blog\/?p=695\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[9,47,48],"class_list":["post-695","post","type-post","status-publish","format-standard","hentry","category-delphi","tag-database-programming","tag-dephi","tag-tclientdatasets"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"If you create a TClientDataset and make it a detail dataset of a master-detail link by setting its master properties, when you run your app and navigate through the Master dataset, the default settings will create a Key Violation error. This is easily remedied by setting your detail TClientDataset.packetRecords to -1. For some reason, every\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"admin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.desiderata.com.au\/blog\/?p=695\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Desiderata software\u00ae and consultancy blog | specialising in clinical database solutions for Australian hospitals\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"A Delphi TClientDataset gotcha \u2013 key violation error when using master-detail datasets | Desiderata software\u00ae and consultancy blog\" \/>\n\t\t<meta property=\"og:description\" content=\"If you create a TClientDataset and make it a detail dataset of a master-detail link by setting its master properties, when you run your app and navigate through the Master dataset, the default settings will create a Key Violation error. This is easily remedied by setting your detail TClientDataset.packetRecords to -1. For some reason, every\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.desiderata.com.au\/blog\/?p=695\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-23T02:55:45+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-23T02:55:45+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"A Delphi TClientDataset gotcha \u2013 key violation error when using master-detail datasets | Desiderata software\u00ae and consultancy blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"If you create a TClientDataset and make it a detail dataset of a master-detail link by setting its master properties, when you run your app and navigate through the Master dataset, the default settings will create a Key Violation error. This is easily remedied by setting your detail TClientDataset.packetRecords to -1. For some reason, every\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?p=695#article\",\"name\":\"A Delphi TClientDataset gotcha \\u2013 key violation error when using master-detail datasets | Desiderata software\\u00ae and consultancy blog\",\"headline\":\"A Delphi TClientDataset gotcha &#8211; key violation error when using master-detail datasets\",\"author\":{\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?author=1#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/#organization\"},\"datePublished\":\"2026-10-23T12:55:45+10:00\",\"dateModified\":\"2026-10-23T12:55:45+10:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?p=695#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?p=695#webpage\"},\"articleSection\":\"Delphi, database programming, Dephi, TClientDatasets\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?p=695#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?cat=6#listItem\",\"name\":\"Delphi\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?cat=6#listItem\",\"position\":2,\"name\":\"Delphi\",\"item\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?cat=6\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?p=695#listItem\",\"name\":\"A Delphi TClientDataset gotcha &#8211; key violation error when using master-detail datasets\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?p=695#listItem\",\"position\":3,\"name\":\"A Delphi TClientDataset gotcha &#8211; key violation error when using master-detail datasets\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?cat=6#listItem\",\"name\":\"Delphi\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/#organization\",\"name\":\"Desiderata software\\u00ae and consultancy blog\",\"description\":\"specialising in clinical database solutions for Australian hospitals\",\"url\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?author=1#author\",\"url\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?author=1\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?p=695#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2e1b81787d3c120839a7ac43aab76a4be8cfa3669c2ebe1886aa1135ba07740d?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"admin\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?p=695#webpage\",\"url\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?p=695\",\"name\":\"A Delphi TClientDataset gotcha \\u2013 key violation error when using master-detail datasets | Desiderata software\\u00ae and consultancy blog\",\"description\":\"If you create a TClientDataset and make it a detail dataset of a master-detail link by setting its master properties, when you run your app and navigate through the Master dataset, the default settings will create a Key Violation error. This is easily remedied by setting your detail TClientDataset.packetRecords to -1. For some reason, every\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?p=695#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?author=1#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/?author=1#author\"},\"datePublished\":\"2026-10-23T12:55:45+10:00\",\"dateModified\":\"2026-10-23T12:55:45+10:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/\",\"name\":\"Desiderata software\\u00ae and consultancy blog\",\"description\":\"specialising in clinical database solutions for Australian hospitals\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.desiderata.com.au\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"A Delphi TClientDataset gotcha \u2013 key violation error when using master-detail datasets | Desiderata software\u00ae and consultancy blog","description":"If you create a TClientDataset and make it a detail dataset of a master-detail link by setting its master properties, when you run your app and navigate through the Master dataset, the default settings will create a Key Violation error. This is easily remedied by setting your detail TClientDataset.packetRecords to -1. For some reason, every","canonical_url":"https:\/\/www.desiderata.com.au\/blog\/?p=695","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.desiderata.com.au\/blog\/?p=695#article","name":"A Delphi TClientDataset gotcha \u2013 key violation error when using master-detail datasets | Desiderata software\u00ae and consultancy blog","headline":"A Delphi TClientDataset gotcha &#8211; key violation error when using master-detail datasets","author":{"@id":"https:\/\/www.desiderata.com.au\/blog\/?author=1#author"},"publisher":{"@id":"https:\/\/www.desiderata.com.au\/blog\/#organization"},"datePublished":"2026-10-23T12:55:45+10:00","dateModified":"2026-10-23T12:55:45+10:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.desiderata.com.au\/blog\/?p=695#webpage"},"isPartOf":{"@id":"https:\/\/www.desiderata.com.au\/blog\/?p=695#webpage"},"articleSection":"Delphi, database programming, Dephi, TClientDatasets"},{"@type":"BreadcrumbList","@id":"https:\/\/www.desiderata.com.au\/blog\/?p=695#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.desiderata.com.au\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/www.desiderata.com.au\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.desiderata.com.au\/blog\/?cat=6#listItem","name":"Delphi"}},{"@type":"ListItem","@id":"https:\/\/www.desiderata.com.au\/blog\/?cat=6#listItem","position":2,"name":"Delphi","item":"https:\/\/www.desiderata.com.au\/blog\/?cat=6","nextItem":{"@type":"ListItem","@id":"https:\/\/www.desiderata.com.au\/blog\/?p=695#listItem","name":"A Delphi TClientDataset gotcha &#8211; key violation error when using master-detail datasets"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.desiderata.com.au\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.desiderata.com.au\/blog\/?p=695#listItem","position":3,"name":"A Delphi TClientDataset gotcha &#8211; key violation error when using master-detail datasets","previousItem":{"@type":"ListItem","@id":"https:\/\/www.desiderata.com.au\/blog\/?cat=6#listItem","name":"Delphi"}}]},{"@type":"Organization","@id":"https:\/\/www.desiderata.com.au\/blog\/#organization","name":"Desiderata software\u00ae and consultancy blog","description":"specialising in clinical database solutions for Australian hospitals","url":"https:\/\/www.desiderata.com.au\/blog\/"},{"@type":"Person","@id":"https:\/\/www.desiderata.com.au\/blog\/?author=1#author","url":"https:\/\/www.desiderata.com.au\/blog\/?author=1","name":"admin","image":{"@type":"ImageObject","@id":"https:\/\/www.desiderata.com.au\/blog\/?p=695#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/2e1b81787d3c120839a7ac43aab76a4be8cfa3669c2ebe1886aa1135ba07740d?s=96&d=mm&r=g","width":96,"height":96,"caption":"admin"}},{"@type":"WebPage","@id":"https:\/\/www.desiderata.com.au\/blog\/?p=695#webpage","url":"https:\/\/www.desiderata.com.au\/blog\/?p=695","name":"A Delphi TClientDataset gotcha \u2013 key violation error when using master-detail datasets | Desiderata software\u00ae and consultancy blog","description":"If you create a TClientDataset and make it a detail dataset of a master-detail link by setting its master properties, when you run your app and navigate through the Master dataset, the default settings will create a Key Violation error. This is easily remedied by setting your detail TClientDataset.packetRecords to -1. For some reason, every","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.desiderata.com.au\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.desiderata.com.au\/blog\/?p=695#breadcrumblist"},"author":{"@id":"https:\/\/www.desiderata.com.au\/blog\/?author=1#author"},"creator":{"@id":"https:\/\/www.desiderata.com.au\/blog\/?author=1#author"},"datePublished":"2026-10-23T12:55:45+10:00","dateModified":"2026-10-23T12:55:45+10:00"},{"@type":"WebSite","@id":"https:\/\/www.desiderata.com.au\/blog\/#website","url":"https:\/\/www.desiderata.com.au\/blog\/","name":"Desiderata software\u00ae and consultancy blog","description":"specialising in clinical database solutions for Australian hospitals","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.desiderata.com.au\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Desiderata software\u00ae and consultancy blog | specialising in clinical database solutions for Australian hospitals","og:type":"article","og:title":"A Delphi TClientDataset gotcha \u2013 key violation error when using master-detail datasets | Desiderata software\u00ae and consultancy blog","og:description":"If you create a TClientDataset and make it a detail dataset of a master-detail link by setting its master properties, when you run your app and navigate through the Master dataset, the default settings will create a Key Violation error. This is easily remedied by setting your detail TClientDataset.packetRecords to -1. For some reason, every","og:url":"https:\/\/www.desiderata.com.au\/blog\/?p=695","article:published_time":"2026-10-23T02:55:45+00:00","article:modified_time":"2026-10-23T02:55:45+00:00","twitter:card":"summary","twitter:title":"A Delphi TClientDataset gotcha \u2013 key violation error when using master-detail datasets | Desiderata software\u00ae and consultancy blog","twitter:description":"If you create a TClientDataset and make it a detail dataset of a master-detail link by setting its master properties, when you run your app and navigate through the Master dataset, the default settings will create a Key Violation error. This is easily remedied by setting your detail TClientDataset.packetRecords to -1. For some reason, every"},"aioseo_meta_data":{"post_id":"695","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"limit_modified_date":false,"created":"2026-10-23 02:50:33","updated":"2026-10-23 03:03:17","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.desiderata.com.au\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.desiderata.com.au\/blog\/?cat=6\" title=\"Delphi\">Delphi<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tA Delphi TClientDataset gotcha \u2013 key violation error when using master-detail datasets\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.desiderata.com.au\/blog\/"},{"label":"Delphi","link":"https:\/\/www.desiderata.com.au\/blog\/?cat=6"},{"label":"A Delphi TClientDataset gotcha &#8211; key violation error when using master-detail datasets","link":"https:\/\/www.desiderata.com.au\/blog\/?p=695"}],"_links":{"self":[{"href":"https:\/\/www.desiderata.com.au\/blog\/index.php?rest_route=\/wp\/v2\/posts\/695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.desiderata.com.au\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.desiderata.com.au\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.desiderata.com.au\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.desiderata.com.au\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=695"}],"version-history":[{"count":1,"href":"https:\/\/www.desiderata.com.au\/blog\/index.php?rest_route=\/wp\/v2\/posts\/695\/revisions"}],"predecessor-version":[{"id":697,"href":"https:\/\/www.desiderata.com.au\/blog\/index.php?rest_route=\/wp\/v2\/posts\/695\/revisions\/697"}],"wp:attachment":[{"href":"https:\/\/www.desiderata.com.au\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.desiderata.com.au\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.desiderata.com.au\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}