L
L
LiptonOlolo2018-07-16 00:42:56
C++ / C#
LiptonOlolo, 2018-07-16 00:42:56

Why is ID ignored?

Hello.
The ID is ignored when added to the table.
Table: gmvRjyqsL67bOm.png
Add code: Vrwop7qsOlpYnr.png
Constantly trying to add a user with ID'om = 0, what's the problem? (I first thought about int ?, but no, it doesn’t even work with int).
The error is something like this: Duplicate entry '0' for key 'PRIMARY'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
LiptonOlolo, 2018-07-16
@LiptonOlolo

[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int ID { get; set; }

A
Alexander, 2018-07-16
@alexr64

Because the ID field is AUTO INCREMENT , i.e. the base itself manages it and you do not need to monitor it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question