Click here to Skip to main content
15,898,036 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hello all

i make a window based project(clinical lab management system) using C#.net and at back end sql server 2005
this will hold a from named patient registration in which information of new patient is registered and after registration we have two numbers
1. reg no.
2. lab no.

i want both these numbers are generated automatically from database but they are set by the user e.g-
reg no. starts from p001
lab no. starts from L001

means next regno is p002,p003 and so on
and same case in lab no also L002............

now i dont know how it is genrated from database
as i know and i made master fro set these numbers
but how they are auto incremental after save in database

thanxz in advance
:doh:
Posted

1 solution

You can use RegNo & LabNo as ID fields in your database. Keep it as Integer type and auto-increment by 1 each time. (this can be done in DB very easily while setting up a table!)

Now since, its just the fixed letter 'P' or 'L', append that whenever you are using them either in query while fetching data or in UI while using it whereever suits you.
 
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