Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
I have a project in hand. where i have to enter serial number,category description,cost price,sale price and image upload.

I want serial number to come automatically through auto generated but not with is identity property.

so if one user enters 20 records and logs off. and then say after 2hrs another user logs in and enters data, that time serial number 21 should get displayed so that the 2nd user understands that 1st user has entered 20 records before her.

is it possible to do this way in asp.net?

i dont want the code. i just want if it can be done and if yes is there any technique?

and i want the serial number should get auto generated sequentialy like 1,2,3....

for example.

user 1 enters 20 records

when user 2 logs in she will see 21 number on serial number field while adding. so that she is aware that 20 records already entered in database.

Thanks
Sudeshna
Posted
Comments
Richard_Michael_RM 25-Nov-14 5:49am    
Go To Database Right click table select design mode then select itemcode field goto properties in Identitiy Specification expand it and set Is Identity Yes and set Indentity Increment.
sudeshna from bangkok 25-Nov-14 5:51am    
i dont want to use is identity property. i have used that. if some one deletes any data, then in that place no data will get inserted.
Richard_Michael_RM 25-Nov-14 6:00am    
sudeshna dont use is identity
insert values from code as i told you by query
sudeshna from bangkok 25-Nov-14 6:02am    
ok i will try this code and will let you know how its working.Thanks. even i also dnt want to use is identity

[^]

cheers
 
Share this answer
 
Comments
sudeshna from bangkok 25-Nov-14 5:31am    
hello. i dnt want that to show in gridview serial number. i have one field in database where serial number exists. that field is my product item code and i have to enter from user end and gets stored in db.

next time when user enters new item, serial number displays new number in textbox field
MAX Query on pageload

int query= select max(product_code) from table
SqlDataAdapter da= new SqlDataAdapter(query, SQLCONNECTION);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.rows.count>0)
{
query = query+1;
query= textbox.text
}

It would be really helpful
 
Share this answer
 
v2
Comments
sudeshna from bangkok 25-Nov-14 5:51am    
Thanks, i will implement this. if it runs will let you know
[no name] 25-Nov-14 5:53am    
The big disadvantage is, that there is a small chance that you generate same serial number for different products in case last product will be deleted.

I suggest to use sequence if available (is available in MySql and MSSQL).
Richard_Michael_RM 25-Nov-14 5:56am    
Agreed #Bruno
sudeshna from bangkok 25-Nov-14 5:58am    
ya i have different products category, so for different products serial number will start from 1
Richard_Michael_RM 25-Nov-14 6:03am    
use where clause for product in max query ...

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