unique insert using aspx vb and sql2005

J

Jim

I'm using framework 3.5, aspx vb and sql server 2005. I have a form that
inserts user names. I don't want duplicate names, so how can I make a field
be unique?

Thanks.
 
E

Eliyahu Goldin

User names are not something that is usually generated automatically. So I
would say you just need to validate every new name by trying to select an
existing record with the same name. If it exists, ask the user to provide
another name.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
D

David Bending

Agreed. You should also make the username a unique index in the database
and catch the exception that will be thrown if you attempt to insert a
duplicate name.

David
Senior Consultant

Eliyahu Goldin said:
User names are not something that is usually generated automatically. So I
would say you just need to validate every new name by trying to select an
existing record with the same name. If it exists, ask the user to provide
another name.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Jim said:
I'm using framework 3.5, aspx vb and sql server 2005. I have a form that
inserts user names. I don't want duplicate names, so how can I make a
field be unique?

Thanks.
 
J

Jim

Thanks for the replies, but I mistyped. I put that I want unique user
names, but what I ment to type was part names. I have a table of parts and I
don't want the names to have duplicates. I see in VSE2008 there are
validation controls, but is there one for unique?

Thanks again.

David Bending said:
Agreed. You should also make the username a unique index in the database
and catch the exception that will be thrown if you attempt to insert a
duplicate name.

David
Senior Consultant

Eliyahu Goldin said:
User names are not something that is usually generated automatically. So
I would say you just need to validate every new name by trying to select
an existing record with the same name. If it exists, ask the user to
provide another name.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Jim said:
I'm using framework 3.5, aspx vb and sql server 2005. I have a form
that inserts user names. I don't want duplicate names, so how can I
make a field be unique?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top