Auto Generate Number with Text

Dear all programmer, I have develop one simple application using visual studio.net 2008 with SQL Server 2008. For this application I want to generate auto number with text example(CUST0001), but I don't know how to coding. Please help me Your sincerely. Thank!

Dear all programmer, I have develop one simple application using visual studio.net 2008 with SQL Server 2008. For this application I want to generate auto number with text example(CUST0001), but I don't know how to coding. Please help me Your sincerely. Thank!

My Dear , * use this source code, ************************************************* Public Function GetIncrementedId(strTable As String, strPrimaryKey As String, strType As String, strWhere As String) As Double GetConnection Dim rstable As New ADODB.Recordset Dim strsql As String ' Create a dynamic sql If strType = "Numeric" Then If IsNull(strWhere) Then strsql = "select max(" + strPrimaryKey + ") as PrimaryField from " + strTable Else strsql = "select max(" + strPrimaryKey + ") as PrimaryField from " + strTable + " " + strWhere End If Else If IsNull(strWhere) Then strsql = "select max(cast(" + strPrimaryKey + " as Integer)) as PrimaryField from " + strTable Else strsql = "select max(cast(isnull(" + strPrimaryKey + ",'') as Integer)) as PrimaryField from " + strTable + " " + strWhere End If End If 'SELECT CAST(RIGHT(RTRIM(ProductBarCode), 4) AS INTEGER) AS Expr1 'From tblPurchaseDetailProduct 'WHERE (LEFT(ProductBarCode, 8) On Error Resume Next Set rstable = Cndb.Execute(strsql) ' If no record found If rstable.EOF = False Then ' then returns 1 for first record GetIncrementedId = IIf(IsNull(rstable!PrimaryField), 0, rstable!PrimaryField) + 1 Else ' otherwise return max number + 1 GetIncrementedId = "1" End If Set rstable = Nothing End Function