0

Hoi

At the moment I'm learing Databases. this is some code that I'm using.
The question that I have is, can I insert a row without ID.
I mean that the database increase the ID number itself.

Thanks in advance.

command = new OleDbCommand();
            command.Connection = connect;
            command.CommandText = "INSERT INTO Calendar (ID, Datum, Titel, Opmerking) VALUES (@ParaID, @ParaDatum, @ParaTitel, @Opmerking)";
            command.Parameters.AddWithValue("@ParaID","ID" );
            command.Parameters.AddWithValue("@ParaDatum", Calendar1.SelectedDate.Date.ToShortDateString());
            command.Parameters.AddWithValue("@ParaTitel", "dit is een test");
            command.Parameters.AddWithValue("@Opmerking", "dit is ook een test");
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by superjj
0

Yes. If omitted from the INSERT, an auto increment column (MySQL) or identity column (MSSQL) will do the rest. Passing the ID as NULL is also possible.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.