How can I enable auto increment primary key in c# when connected to database in mysql? I'm looking for a way when I add a data to the database using C# it will automatically give me an ID that will be in order. For example I am a manager in a company and I want to add a new item that I do't need to enter the id.
That is normally the database's job. Set column for the ID to be auto incrementing. Write the query in such a way that it rereads the just inserted row (as a stored procedure or as an insert/select pair). Now you have your unique ID right after insert. HTH