Making a substring plus data from sql database column

raydrezack

New Member
I am trying to create, lets say a user ID. I have a sql server database and i have a user webpage developed in asp.net. On my user page, a user fill out the information in the text boxes(First Name, Last Name, Middle Initial and so on) and when a user clicks a submit button, the entered information is added to a database. I have an auto increment column in the database, so when the information is added to the database the row has a auto increment number, for example 1. Each time the new row is added the auto increment number rises on one. I want to create an unique UserID. It should contain the first 4 letters of a Last Name, which user fills out on a user web page and the auto increment number from the database. I have a code to retrieve the first 4 letters of the last name ( string FirstFour = txtNewUserLN.Text.Substring(0, 4);) but i need to add auto increment number from the database to that string.Could anyone help me with it?
 
Back
Top