unique insert using aspx vb and sql2005

  • Thread starter Thread starter Jim
  • Start date Start date
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.
 
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
 
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.
 
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.
 
Back
Top