hi,
how to auto increment the value in database table when the button clicks.i have created a table named register .when the user completes his registration we will generate the receipt based on the registration. so for every receipt we will generate the receipt no on that. when we click on receipt button,give the receipt ,it contains name,date,registration no. , amount,receipt no. .so we have to generate these fields as receipt.. so can u tell me solution for that..

Use an autoincrement column.

Alter Table Receipt Add ReceiptNo int identity(1000, 1)

hi,
thanks for ur reply.. but i need to print the receipt with the receipt no. and along with the register fields. can i write the query like this..
insert into receipt(applicationno,name,date)values (select applicationno,name,date from register);
is it right or not.plz tell me..

hi..
it gives the error "Column names in each table must be unique. Column name 'receiptno' in table 'receipt' is specified more than once." so how can i overcome this error.. plz tell me the solution.thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.