473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

auto generate number in asp.net which is auto add in sql server table with other data

I have project in asp.net with sql server backend.
i want to auto generate a number for particular column.
with the auto generated number i want to insert some other data in the same row same table. on button click event.

details
railway PNR no.:- want to autogenerat
passenger details:- want to inserted simultaneously

pls help me
jagdish_contact27@yahoo.co.in
Mar 30 '11 #1
2 4937
VijaySofist
107 100+
Hi,

Using SQL Server - In Table Design Set that "PNRNo" Column as Primary Key and Set IsIdentity=Yes

At the End of your Insert query Add the Following Line

Expand|Select|Wrap|Line Numbers
  1. Select @@identity;
- This Will Return the PNRNo Value. Using this value you can use the update query.

If this is not the answer you expected, Post your Code here.

Regards
Vijay.R
Mar 30 '11 #2
silwar
7
1. for PNR column choose data type numeric.

2. Go to Column properties window and expand Identity specification option.

3. Where it is written Is Identity select yes.

4.In the same menu you can also provide Identity increment for how much it increments every time e.g. If you want to increment value by 1 number every time data is recorded put value 1.

5. you can also set starting seed so that you don't have to do that manually. e.g. put 101 if you want first record should have pnr no = 101
Mar 31 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Sebastien | last post by:
Hi, I am building a products database, linking sales and production. Each part has a unique sales Stock Code and Production Number. The sales stock code is a combination of letters and numbers...
2
by: SalimShahzad | last post by:
Dear Gurus, i had written following codes to auto generate the next claim no Private Const strC = "GCT/02/J/" Private Sub Command1_Click() Dim stra, stre As String Dim intb, intd As Integer...
5
by: Phil Latio | last post by:
I have 2 virtually identical tables and wish to move data between them. Basically one table is called "live_table" and the other is named "suspended_table" and the only difference is that the...
8
by: dougawells | last post by:
Hi - I'm hoping for help with the auto-generation of a hyperlinked listing of all files in a directory. The server I use does not auto-generate this. So, when someone comes to this directory and...
2
by: G | last post by:
Hello Firends I want a sample code for developing an " auto genearte number " and want to store in database. Please if you find any code please send Thanks in Advance G
27
by: 3acks | last post by:
I've read a lot of articles and forums trying to figure this one and have yet to come up with a solution I can get to work. I need to create a unique id. I can do this using Dmax to find the...
1
by: thegenius | last post by:
Hi everyone, can anyone tell me, how can I auto generate such kind of table. I want to use php/mysql databse thanks in advance
1
by: PerumalSamy | last post by:
HI I done a project in asp.net with VB coding and sql server 2005 as back end. Now i need to generate an auto email everyday for current date based on the date field in my database table . ...
9
zimes
by: zimes | last post by:
I am working with Microsoft Access 2003 from the Office XP pro suite. I have created several tables that have to do with Asset tracking along with purchasing. I have a table called Purchasing,...
7
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.