Hi All,

I've created a registration form in VB.Net. Now I want to validate it, like if the username is previously used by some one then it wont allow to register. I can do it in ASP.Net, But I m not able to find any solution for VB.Net. If any body have any code snnipet then plz send me or give me few suggestion.

Thanks
M

you just check each of the value in registration form with data in your database, what the problems...
if u can save and show data from database so its not difficult to validate registration from with database.

if you can do in asp.net with vb, it think you can do the same. so what the effort of your code?

for validation you have to follow this


1 compare the text value with each user name record field.

2. if any record find out with same name you have to given message to user "user name all ready used by some one you have to chose another name" .


3. if no record is found create and save to data base.


for any type of web related information you can visit
http://webdesigningcompany.net

'declare connectionstring to server

    'assuming your table name where users are stored is called 'Users' 
    'and the column name to verify a user is called 'username'

    Dim SelectStmt As String = "SELECT * FROM users WHERE UserName ='" +   userNameTextBox.Text + "' and " + _
                "Password ='" + passwordTextBox.Text + "'"

    Dim dc As SqlCommand = New SqlCommand(SelectStmt, con) 'assming your connectionstring is called 'con'

    Dim reader As SqlDataReader = objcommand.ExecuteReader

    If reader.Read Then

	'enter codes on what the system should do if the user exists

    Else

   MessageBox.Show("Invalid Username or Password!", "Login Error", _
                MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning)
    End if
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.