form field auto numbering with unique value

G

Guest

Before I started to create table, etc to track unique form field record
number assigments I thought I'd check to see if there is now a better way to
do this in .NET.

I have a parent form (table) and children form (table). Relationship equals
one to many. I'd like to auto number the fields accordingly and traditionaly
I assign a unique number based on a table value that I retrieve + 1.
i.e.
Parent record field value = 1
Children record field value = 1-1, 1-2, 1-3

I assume that I could get the next field auto-increment interger for the
parent table record and assign my parent field to it. But what about the
child field then that I need to relate to that parent for each child? Make
sense?

Do I search the child table getting results for number of records for parent
match then add 1 to it? I would think that there is a better way now.

A simple way to uniquely number the parent record and the child, with the
child record also having the parent assigment value. But the child has to
start at one each time. Can I do this in my SQl Server 2K field properties?

thanx.
 
J

John Saunders

Chris said:
Before I started to create table, etc to track unique form field record
number assigments I thought I'd check to see if there is now a better way
to
do this in .NET.

I have a parent form (table) and children form (table). Relationship
equals
one to many. I'd like to auto number the fields accordingly and
traditionaly
I assign a unique number based on a table value that I retrieve + 1.
i.e.
Parent record field value = 1
Children record field value = 1-1, 1-2, 1-3

I assume that I could get the next field auto-increment interger for the
parent table record and assign my parent field to it. But what about the
child field then that I need to relate to that parent for each child? Make
sense?

Do I search the child table getting results for number of records for
parent
match then add 1 to it? I would think that there is a better way now.

A simple way to uniquely number the parent record and the child, with the
child record also having the parent assigment value. But the child has to
start at one each time. Can I do this in my SQl Server 2K field
properties?

What are you planning to do with the field numbers?

John Saunders
 
G

Guest

That's the issue. I put them into a form textbox (disabled) because the user
can also on that form (both parent and child) call up pop-up's that need
those numbers to also associate that record to.
i.e if you're on the child record and it's number is 1-1 then if you pop-up
the upload image modal form then that image is associated to that number
also. For retrieval later so that specific detail record number.
The big issue isn't the parent becuase I can get that and make it unqiue,
the child has the chnace to have multiple users adding to it (small
possiblity) so if I assign it the numbering sequence of 1,2,3... then if 3
has been assigned (by routine checking last detail/child record) and then
another user adds a record and gets the same number because the 1st user has
not saved their record. It's a small chance, but a chance nonetheless. I
could "lock" the child/detail table but that would kill all other users
working/adding new parents and children to them. And since it's a new record
and not modifying an existing one I can't lock it either. Unless there is a
way to lock based on a serach criteria (i.e. if parent = "1" then lock all
associated child records)??????
Make sense?
 
J

John Saunders

Chris said:
That's the issue. I put them into a form textbox (disabled) because the
user
can also on that form (both parent and child) call up pop-up's that need
those numbers to also associate that record to.
i.e if you're on the child record and it's number is 1-1 then if you
pop-up
the upload image modal form then that image is associated to that number
also. For retrieval later so that specific detail record number.
The big issue isn't the parent becuase I can get that and make it unqiue,
the child has the chnace to have multiple users adding to it (small
possiblity) so if I assign it the numbering sequence of 1,2,3... then if 3
has been assigned (by routine checking last detail/child record) and then
another user adds a record and gets the same number because the 1st user
has
not saved their record. It's a small chance, but a chance nonetheless. I
could "lock" the child/detail table but that would kill all other users
working/adding new parents and children to them. And since it's a new
record
and not modifying an existing one I can't lock it either. Unless there is
a
way to lock based on a serach criteria (i.e. if parent = "1" then lock all
associated child records)??????
Make sense?

No, not really. Don't these tables have primary keys? Why not use the
primary key to identify the record, since that's what it's for?

John Saunders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top