Click here to Skip to main content
15,905,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
sir

C++
 i have one table name Register.It contains  three columns
userid 
Firstname 
lastname 

in my front end design i create
two textboxes and one submit button.

My requirement is when iam entering submit button firstname and lastname getvalues from textbox1 and textbox2 but  userid coloumn will get values automatically like that userid0001
                                                userid0002
                                                userid0003
                                                     :
                                                     :
                                                     :
for how many times we click submit button that much of time we get increment in the userid coloumn.
Pls help me
Posted
Updated 24-May-11 20:19pm
v2
Comments
Ashishmau 25-May-11 1:55am    
Need more clarification
kranthi.oru 25-May-11 2:06am    
my requirement is i have one table name Register.It contains columns
userid Firstname lastname in my front end design i create
two textboxes and one submit button.

My requirement is when iam entering submit button firstname and lastname getvalues from textbox1 and textbox2 but userid coloumn will get values automatically like that userid0001
userid0002
userid0003

Hi Kranthi,
I really don't understand your exact requirement!
Do you mean concatenate column name with its value? or concatenate values of 3 columns together for each row?

To concatenate the values of 3 columns together

SQL
DECLARE @tmpTable TABLE (userID VARCHAR(10), Name VARCHAR(10))
INSERT INTO @tmpTable VALUES ('ID1','NAME1')
INSERT INTO @tmpTable VALUES ('ID2','NAME2')

SELECT  userID + Name FROM @tmpTable
 
Share this answer
 
As far as i Understood,
U want autogenerate ID for a particular user.
For that u can use IDENTITY in your database.
While showing in front end, u can Concatenate ur ID like
userid+(id from database).
 
Share this answer
 
I think you mean you want to order the values in a specific column.
Your qeury should look something like this:
SQL
SELECT userid, firstname, lastname FROM mytable ORDER BY userid ASC --ending

You could also ORDER BY another column or ORDER BY userid DESC(ending)
Maybe you are using LINQ? That has an Order By Asc/Desc too.

I hope this is what you wanted to know. Good luck :)
 
Share this answer
 

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