Greetings guys can you help me with this one,

i want to validate if the username is already taken or not yet but i don't have a clue on how to do it.

i tried this code

dtCustomer.Rows.Count > 0

but it didn't work @_@.. please guys i really need help thanks in advance :D.

Recommended Answers

All 2 Replies

Easiest way is to wuery the database as in

SELECT COUNT(*) WHERE Username = 'joeblow'

If the returned value is 0 then the username is available. I suggest you use parameters to create the query string. How you do that depends on whether you are using OleDB or SqlClient. You can find examples of both here

Thanks you sir :D!

Be a part of the DaniWeb community

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