I have a program that creates a unique key for a database. However I get an error that I am trying to write duplicate data to the database. How can I fix this?
Code:
private string GenerateScanID()
{
string scanID;
scanID = "SC-" + DateTime.Today.Day + "-" + DateTime.Today.Month + "-" + DateTime.Today.Year + "-" +
DateTime.Now.ToString("hh-mm-ss.ffff");
return scanID;
}
Sample output:SC-10-6-2015-09-21-34.1139-0
SC-10-6-2015-09-21-34.1139-1
SC-10-6-2015-09-21-34.1139-10