Do not do this!
Although it's possible, MySQL is a multiuser system, so it is very, very likely that two or more users will end up trying to use the number. That's dangerous: either someone will lose data, or the wrong data will get attached to the wrong client.
Use an
AUTO_INCREMENT[
^] solumn instead, and fetch the number only after you have created the record.
Formatting an integer with leading zeros in .NET is trivial:
Dim i as Integer = 123
Dim s as String = i.ToString("D5")
Will give you a string "00123"