Click here to Skip to main content
14,973,838 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear sir
I created a registration form . It contains

User Id
First Name
Last Name
Email Id
Doj
Address

I create a table for above details in sqlserver

but problem is when i am clicking submit button, There is another coloumn Named UserId when iam filling Registration form I want automatically get
User Id details

user0001
user0002
.
.
.
.
user00009
user00010
user00011


Please help me in this

Thanks in Advance.
Posted
Updated 20-May-11 0:28am
v2
Comments
senguptaamlan 20-May-11 6:30am
   
please give some insight of what you have done and in which code part you are facing the problem
kranthi.oru 20-May-11 6:42am
   
<table class="style1">
<tr>
<td class="style2" align="right" bgcolor="#CCFFCC">
Enter First Name</td>
<td align="left">
<asp:TextBox ID="TextBox1" runat="server">
</td>
</tr>
<tr>
<td class="style2" align="right">
Enter Last Name</td>
<td>
<asp:TextBox ID="TextBox2" runat="server">
</td>
</tr>
<tr>
<td class="style2" align="right">
Ente EmailId</td>
<td>
<asp:TextBox ID="TextBox3" runat="server">
</td>
</tr>
<tr>
<td class="style2" align="right">
Adress</td>
<td>
<asp:TextBox ID="TextBox4" runat="server">
</td>
</tr>
<tr>
<td class="style2" align="right">
Doj</td>
<td>
<asp:TextBox ID="TextBox5" runat="server">
</td>
</tr>
<tr>
<td class="style2" align="right">
Designation</td>
<td>
<asp:TextBox ID="TextBox6" runat="server">
</td>
</tr>
<tr>
<td class="style2" align="right">
Qualification</td>
<td>
<asp:TextBox ID="TextBox7" runat="server">
</td>
</tr>
<tr>
<td class="style2" align="right">
 </td>
<td>
 </td>
</tr>
<tr>
<td class="style2" align="right">
 </td>
<td>
<asp:Button ID="btnSubmit" runat="server" onclick="btnSubmit_Click"
Text="Submit" />
</td>
</tr>
<tr>
<td class="style2" align="right">
 </td>
<td>
 </td>
</tr>
<tr>
<td class="style2" align="right">
 </td>
<td>
<asp:Label ID="lblDisplay" runat="server">
</td>
</tr>
</table>
kranthi.oru 20-May-11 6:44am
   
In the above code contains a button btnSubmit when iam clicking that
UserId coloumn automatically getting
user0001
user0002
.
.
.
.
user00009
user00010
user00011
values like this

1 solution

Set the UserID column to be int, autoincrement (for sequential IDs), or to uniqueidentifier, default value newid() (for GUIDs).
   
Comments
Sergey Alexandrovich Kryukov 20-May-11 22:12pm
   
I would say GUID makes little sense but integer (better be System.Uint64) would do perfectly. (Voted 4).
--SA
BobJanova 21-May-11 6:37am
   
I rather agree but it is quite a common thing I've seen, on my travels around the Internet. I would always use int (if you're going to be overflowing int with your ids then that's 2 billion records and there are other things that will kill you first).
   
You see, GUIDs are robust and were very well advertised. As as result, many developers over-used them beyond the rational reasons. I mean, many designs based on using GUIDs are wrong. Integers in this very example are rationally proven, GUIDs are not: they do not adding any value but adding some risk (albeit very little) and performance leak.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900