什么用作身份证明? [英] What to use as an Identification?

查看:72
本文介绍了什么用作身份证明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hy,



我在SQL中有一个表,我使用ID(自动生成)将该表链接到其他表并识别运输订单我们的司机(CMR号码)。现在我将该表与主要订单表中的付款和费用相关联。在SQl或VS中没有链接。我只是在链接表中插入了它所链接的ID,并在C#win表格datagridview上显示链接表。



上周旧项目/表(现在正在运行的)与Access数据库上运行的相同结构有一些ID-s的问题(每隔一秒ID就有两次)。通过修复每个链接和CMR编号都会发生变化,这样每个价格和成本都会丢失。



所以在SQL上,每个问题和ID列的丢失都会弄乱所有数据。



我们的新C#应用程序中是否有更好的解决方案来防止此类问题?



据我所知,我知道有3个解决方案:

1-制作一个我自己生成的运行ID (但我也可以制作双ID并且有这样的问题)

是否有一些规则如何制作这样的功能?

我不想再发明轮子了。



2-使用GUID进行链接。这是一个好主意,因为SQL过滤链接datagridview中的数据。它会慢吗?



3-留下身份证并希望最好。



对不起,如果这是一个愚蠢的问题......我是C#和SQL Servers的新手......实际上对整个编程场景:)

Hy,

I have in SQL a Table on which I use the ID (auto generated) for linking that table to other tables and for identifying Transport Orders for our Drivers (CMR Number). For now I´m linking that table with the Payments and costs over the ID in the Main Order Table. It's no Link in SQl or in VS. I just insert in the linked Table the ID for which it is linked and show the linked tables on a C# win form datagridview.

Last week the old Project/Table (that is running now) with the same structure running on an Access DB had some Problems with the ID-s (every second ID was twice there). By repairing that every Link and CMR Number changed so that every price and cost is lost.

So on SQL every problem and drop of the ID Column would mess up all data.

Is there a better solution to prevent such things in our new C# Application?

As far as I can se there are 3 solutions that i know:
1- Make a running ID that i generate on my own (but i could also make double ID-s and have such problems )
Are there some rules how to make a function like that?
I don´t want to invent the wheel again.

2- use GUID for the linking. Is that a good idea because the SQL filtering linked data in the datagridview. Would it be to slow?

3- Leave it with the ID and hope for the best.

Sorry if it is an stupid question...I´m new to C# and SQL Servers..actually to the whole programming scene :)

推荐答案

这不是在SQl或VS中链接。



你的意思是你没有在你的牌桌之间放置参考牌吗?



这可能是问题所在。如果要强制执行参照完整性,则必须在表之间设置一些参考约束,并配置级联模式。



良好的起点将是:

实施参照完整性和级联操作 [ ^ ]

外键约束 [ ^ ]



另请参阅 SQL SERVER外键和索引 [ ^ ]
"It's no Link in SQl or in VS."

Do you mean that you did not put a reference in place between your tables?

That could be the problem. If you want to enforce your referential integrity, you have to set up some reference constraints between your tables, and configure the cascade mode.

Good starting points would be:
Implementing Referential Integrity and Cascading Actions[^]
FOREIGN KEY Constraints[^]

See also SQL SERVER Foreign Keys and Indexes[^]


这篇关于什么用作身份证明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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