修改主键 [英] Modification of Primary key

查看:89
本文介绍了修改主键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将vb 2005与sql 2005一起使用

我有一个用主键在sql 2005中创建的表.我将数据导入了我的数据集中.

在我的表单上,我希望VB自动阻止修改现有记录的主键字段.

该怎么办

感谢

解决方案

在不知道如何显示数据的情况下,很难说.不过,最简单的方法是不显示主键.我很少遇到密钥为用户提供任何值的情况,因此他们不必理会它-这意味着他们不需要查看它.


您好fez1,
这完全取决于您检索数据的方式,如果您使用对象数据源之类的任何类型化数据集"方法,它将自动将主键字段标记为只读"

I''m using vb 2005 with sql 2005

I''ve a table created in sql 2005 with a primary key. I''m imported the data in my dataset.

On my form I want VB to automatically prevent modification of the primary key field for an existing record.

how can this be done

thanks

解决方案

Without knowing how you''ve displayed your data, it''s hard to say. The easiest way though is to not show the primary key. I''ve rarely encountered a situation where the key provides any value for the user, so they should not care about it - which means they don''t need to see it.


Hi fez1,
It is totally depends on the way in which you retrieve the data, if you go with any of the ''typed data set'' approaches like Object data source, it automatically mark primary key field are ''read only''


这篇关于修改主键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆