数据库中的Id是什么数据类型使用的?

时间:2022-09-15 18:38:48

I am working with Access database for a C# winform application.I want to create software, which stores the patient's details.I have assigned a patient_Id for each patient, Patient_Id is of "AutoNumber" datatype so that it will automatically increment. My problem is when same patient comes again then New Patient_Id automatically generated to store his new current data, but for same patient I want only one ID.

我正在使用Access数据库进行C#winform应用程序。我想创建存储患者详细信息的软件。我为每个患者分配了一个patient_Id,Patient_Id为“AutoNumber”数据类型,以便它自动递增。我的问题是,当同一患者再次来时,New Patient_Id会自动生成以存储他的新当前数据,但对于同一患者,我只想要一个ID。

1 个解决方案

#1


0  

Use some unique data as a field in your patient table (such as social security) and when a patient comes, look up this unique number and determine if he is a new patient or a returning one. This is a simple SELECT query something like:

使用一些独特的数据作为患者表中的字段(例如社会保障),当患者来时,查找这个唯一的数字并确定他是新患者还是返回患者。这是一个简单的SELECT查询,如:

"SELECT patient_Id FROM tPatients WHERE SSN=@sNum"

#1


0  

Use some unique data as a field in your patient table (such as social security) and when a patient comes, look up this unique number and determine if he is a new patient or a returning one. This is a simple SELECT query something like:

使用一些独特的数据作为患者表中的字段(例如社会保障),当患者来时,查找这个唯一的数字并确定他是新患者还是返回患者。这是一个简单的SELECT查询,如:

"SELECT patient_Id FROM tPatients WHERE SSN=@sNum"