Reputation: 13250
I would like to generate a sequence of numbers as "A0000"(ie.. an alphabet followed by 4numbers not randomly generated numbers).
I have gone through this article which is done with Sql Server similarly how can I achieve it in VB.Net.
Here is the code for SQL Server:
create function CustomerNumber (@id int)
returns char(5)
as
begin
return 'C' + right('0000' + convert(varchar(10), @id), 4)
end
Any suggestions are welcome.
Upvotes: 2
Views: 1673
Reputation: 9888
The same function in VB.NET:
Function CustomerNumber(id As Integer) As String
return "C" & id.ToString("0000")
End Function
Upvotes: 4