本节讲解数据约束:唯一和必须。
往往在数据库中,有些字段是有约束的,比如订单编号不允许重复,这就是唯一约束,并且每个订单必须有订单编号,这个就是必须约束。
在活字格中,选择字段,然后勾选表工具中的 必须/唯一就可以设置这个字段的必须/唯一约束了。
当有约束的情况下,在页面端提交数据时候,如果不符合条件,会弹出更新数据失败的错误。
<video src="http://video1.grapecity.com.cn/HuoZiGe/Tutorials/第9章数据管理/9.2数据约束.mp4" width="800" height="450" poster="http://video1.grapecity.com.cn/HuoZiGe/Tutorials/第9章数据管理/9.2数据约束.jpg" controls="controls" onplaying="startplay()">您的浏览器不支持播放此视频。</video> <script> var isplayed = 1; var startplay = function(){ if(isplayed){ ga('send', 'event', 'Play Video', '活字格', '第9章 数据管理'); isplayed = 0; } return false; } </script> |