473,779 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent: Creating auto increment numbers in JAVA

2 New Member
Please guide me as how do can we create a aut generated number...

I have created a database. I am giving each name in the database entry a unique ID

I want the Unique ID to be auto generated when I want to add an entry in the database in an increment fashion

Do let me know ur views and the code that works...I m in urgent need of it...........

thanks a lot
Feb 3 '07 #1
3 6223
r035198x
13,262 MVP
Please guide me as how do can we create a aut generated number...

I have created a database. I am giving each name in the database entry a unique ID

I want the Unique ID to be auto generated when I want to add an entry in the database in an increment fashion

Do let me know ur views and the code that works...I m in urgent need of it...........

thanks a lot
If you want to do this manually you can use another table to stores the current reference number and write a static method in some utility calss that generates a referenceNumber by incrementing the value of this field and returning the result.
Feb 3 '07 #2
crazy123
2 New Member
If you want to do this manually you can use another table to stores the current reference number and write a static method in some utility calss that generates a referenceNumber by incrementing the value of this field and returning the result.





Thanks for the reply but I m not very clear about storing the current reference number in another table, as we have name only name as a reference .....and a unique ID against it to distinguish ...which (the unique id ) I want to be auto generated...
Feb 3 '07 #3
r035198x
13,262 MVP
Thanks for the reply but I m not very clear about storing the current reference number in another table, as we have name only name as a reference .....and a unique ID against it to distinguish ...which (the unique id ) I want to be auto generated...
You can use the same table if you like and add a field for the last generated ref number.When next time you want to create a new entry you check the value of this field, increment it by one and use that for the next id then you set that value as the last generated ref number.
Feb 3 '07 #4

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

Similar topics

11
2792
by: csomberg | last post by:
SQL 2000 I thought I would throw this out there for some feedback from others. I'd like to know if you feel using MS auto-increment field is a good solution these days or should one grow their own ? Thanks, Me.
0
3892
by: Santosh | last post by:
Hi, I have a requirement in which I need to create an auto increment column in a file which will be unique. The following is what I am trying to do. 1) I need to use DDS to define the file 2) The auto-increment field can go upto a 5 digit numeric value. 3) As the records from this file will be deleted at regular intervals.I need the ability to recycle deleted record numbers after the 5 digit limit has been reached.
6
5073
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I do with the 1st column ? (Below I have a "1" in place for now). Also, Does the datase.AcceptChanges(); updates the changes to the database? Which command do I use to update the changes in dataset back to the Access database table? Thanks, Alpha...
5
5156
by: Pauloviè Michal | last post by:
hi all, I have problem with SERIAL field type (or sequence functionality). I have table with three columns - ID, IDS, NAME. I want auto-increment IDS grouped by ID. Example: 1, 1, Ferdo 1, 2, John 2, 1, Martin 1, 3, Elvira
13
4728
by: S.Dickson | last post by:
I had an access database that i use as an ordering system. I have a form for entering customer details. When i add a new customer on the form the customer number is an auto number that appears when i type in the details. I have just moved over to mysql server with access as the front end. I have setup the sql tables with the customer number as autonumber. When i go into the form and add a new customer it does not generate the
0
2700
mmarif4u
by: mmarif4u | last post by:
Hi guys,,, I have simple problem, Problem is that, i want that a php variable create date with numbers, look like this: $rtno = date("md,here some numbers but auto increment start from 001 and going on"); here md is month and date...
5
3554
by: koonda | last post by:
Hi all, I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can play. The players numbers can fill the board, but I have problem implementing the winner for the...
1
3196
by: jimilives | last post by:
I forgot to turn on auto increment when I reinstalled this database and now I have a bunch of NULL values in my ID field for last few hundred inserts, how can I update this table to replace the NULLS with a new ID value where the ID is an auto increment with out losing the ID values of old records, basically i want to do this: UPDATE ID SET id = 'NEW AUTO #' where ID = 'NULL' I hope this makes sense, I am not bound to having the numbers...
1
4250
AaronL
by: AaronL | last post by:
Hello, First I would like to say thank you all for your help in the past. I am stumped again. I am creating an e-commerce system and I want to be able to upload images to the server and assign them to products. For the product ID, I have an auto increment value for the primary key to avoid duplicate item numbers. Since I do not want to pass all of my record values to my image upload program (when I write it), I assume to just submit...
0
9636
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7485
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.