dualshck012
Active member
Good day!
I'm creating a function for incremented ID generation
I'm getting an error: {"Input string was not in a correct format."} under line Convert.ToIns32(maxId). I also tried Int32.TryParse with the same error. The Output would be something ICTS2021002
I'm creating a function for incremented ID generation
I'm getting an error: {"Input string was not in a correct format."} under line Convert.ToIns32(maxId). I also tried Int32.TryParse with the same error. The Output would be something ICTS2021002
C#:
string maxId = mysqlconstring.reader3[0].ToString();
if (!string.IsNullOrWhiteSpace(maxId) && maxId.StartsWith(prefix))
{
int count = Convert.ToInt32(maxId);
newId = string.Format("ICTS{0}{1:000}", DateTime.Now.Year, count + 1);
}