List Info

Thread: RE: want to get the next ID before inserting




RE: want to get the next ID before inserting
country flaguser name
United States
2007-09-13 23:39:48
Well,

Given such specs, you look at them and communicate back the
user your
concerns.

>From a technical perspective we can do:
A - which means.....will happen.
or
B - which means......will happen.
Which is preferable to you?

I think that whether you show some ID either at the
beginning or end of
the task, whatever it might represent, the user will latch
on to it as
"theirs"  and will resent it if some user
"X" has instead latched on to
it.  

Phil J.
 

  

On Thu, 2007-09-13 at 23:03 -0400, Jones, Larry wrote:
> Sorry for typo.  POBs shoud be PHBs (Pointy Haired
Bosses).
>
____________________________________________________________

> 
> Ken,
> 
> I understand your concerns about limiting your career,
and certainly the
> consequences of the code should be weighed against your
current working
> environment and incipent cash flow, harump, harump ...
> 
> However, since we did not have details on the
environment it is hard to
> say what would be workable.  If there was only one
person entering data
> at a time then there would never be a problem and my
solution would work
> perfectly for everyone.  If there was a chance that
only occasionally
> there could be a double hit on one ID, then it would
still probably work
> OK.  If there was massive numbers of people updating
the file
> simultaneously then it probably wouldn't be a good
solution.
> 
> Also, I am not sure you understood what I was
suggesting.  The number
> returned to the user would be correct, unless someone
else came along at
> the same time and requested a new ID also.  For the
actual adding of the
> record there would never be an integrity problem since
it would use an
> Identity column.  If the number it ended up with turned
out to be
> different than the previewed one I would display a
message to the user
> immediately upon adding saying something like,
"Your preview # was used
> by another user.  Record added with ID# 12345".
> 
> Obviously, if there was an actual need to have the ID
ahead of time,
> like they were going off and entering the ID in another
system and then
> going back and doing the data entry, then this would
not be workable.
> So, when I was suggesting this as *possibility* I was
assuming there was
> not any real need.  I also would assume that any such
scheme would be
> run by the manager for approval and not done as a
covert operation.
> 
> Believe me I understand the intricacies of
record-locking schemes.  I
> wrote ISAM file handlers in assembly language back in
the 70's and
> grueled over the many possibilites of data getting
messed up in
> multi-user environments.
> 
> I was being somewhat flippant referring to the POBs,
and saying "who
> cares", not so much out of disrespect to the
managers but in an attempt
> to bring some levity to the scene.
> 
> Ultimately, it seems to me to be a judgement call of
how to go about a
> solution depending on factors like how many users there
are, how many
> use the application at the same time, is there any
other processing
> going on in another system using the ID, and lastly how
comforable you
> as a developer feel with the solution based on your
knowledge of the
> project and relationship with other involved.
> 
> Happy Programming,
> 
> Larry Jones 
> Hydrel/AcuityBrands   
>  
> 
> -----Original Message-----
> From: Ken Schaefer [mailto:KenadOpenStatic.com]
> Sent: Thursday, September 13, 2007 9:14 AM
> To: aspnet-databasesaspadvice.com
> Subject: [aspnet-databases] RE: want to get the next ID
before inserting
> 
> > Since the preview has no known purpose, who
cares.
> 
> Whilst Ian doesn't know what the purpose of the preview
is, that doesn't
> mean that there isn't some legitimate business need for
it.
> 
> As a programmer, who's given some specs, you can't say
"I don't
> understand why they want to do this, so I'll just do it
some other way
> that's easier for me. Who'll care?" That's usually
a career limiting
> move in my experience.
> 
> Cheers
> Ken
> 
> 
> -----Original Message-----
> From: Jones, Larry [mailto:LJonesLithonia.com]
> Sent: Saturday, 25 August 2007 8:19 AM
> To: aspnet-databasesaspadvice.com
> Subject: [aspnet-databases] RE: want to get the next ID
before inserting
> 
> BTW, I didn't suggest actually doing the insert with
the Max ID +1, but
> just showing it as a preview for the POBs. 
> 
> If in the rare case the preview disagreed after the
insert was done a
> little pop-up could even inform them of it, and give
the user the new
> real ID.  Since  the preview has no known purpose, who
cares.
> 
> Larry Jones
> Hydrel/AcuityBrands
> 
> 
> -----Original Message-----
> From: PhilJackson [mailto:pjackson1hot.rr.com]
> Sent: Thursday, August 23, 2007 7:38 PM
> To: aspnet-databasesaspadvice.com
> Subject: [aspnet-databases] RE: want to get the next ID
before inserting
> 
> The whole idea seems bogus, but methinks that if you
are going to show
> that ID before it is actually saved, you better insert
a row with some
> minimal info and do the update later.  Unless you are
talking about a
> single-user desktop app,each with their own copy of the
DB.  Adding 1 to
> the max ID is horrifically bad idea.  A user could
navigate to the page
> where that ID is displayed,go for a coffee break, etc.,
come back and
> that ID is associated with something else.   Doing the
insert
> first,you'll just potentially end up with a bunch of
incomplete bogus
> rows and gaps in the sequence to clean up....not
knowing what the app
> does, that would offer a way to partially complete the
process, leave
> and come back later to finish if that ID is known? 
Only reason I can
> see for doing this....
> 
> 
> 
> On Thu, 2007-08-23 at 21:32 -0400, Steven Smith wrote:
> > What if two people hit the Add Record page at the
same time?  They'd 
> > both get the same number.  At least one of them
would be wrong.
> >
> > Steve
> >
> >
> > --
> > Steven A Smith | ASP.NET MVP | Microsoft Regional
Director President, 
> > ASPAlliance LLC | http://aspalliance.com
ssmithaspalliance.com
> >
> >
> >
> >
> > -----Original Message-----
> > From: Jones, Larry [mailto:LJonesLithonia.com]
> > Sent: Thursday, August 23, 2007 9:07 PM
> > To: aspnet-databasesaspadvice.com
> > Subject: [aspnet-databases] RE: want to get the
next ID before 
> > inserting
> >
> > I am late on the thread, but I was wondering why
you didn't just 
> > return
> > MAX(ID) +1 on an auto-increment field for the
preview of the number.
> >
> >
> > Larry Jones
> > Hydrel/AcuityBrands
> >
> >
> > -----Original Message-----
> > From: merkimerk.com [mailto:merkimerk.com] On Behalf Of Ian Lipsky
> > Sent: Thursday, August 23, 2007 10:26 AM
> > To: aspnet-databasesaspadvice.com
> > Subject: [aspnet-databases] RE: want to get the
next ID before 
> > inserting
> >
> > Yes, thanks. I know about that. I know how to get
the id of an 
> > inserted record. I was just wondering if there
were a better way other
> 
> > then 'wasting' a table just to get ID numbers.
> >
> > thanks to everyone. I've already implemented
this.
> >
> > Ian
> >
> > On 8/23/07, Reji Gopalakrishnan <rejigopugmail.com> wrote:
> > > HI
> > >
> > > In DB SP after insert get scopeidentity value
and retrun that to 
> > > .net page
> > >
> > > Rej
> > >
> > > On 8/23/07, ravi pinnoju <ravi_pinnojuyahoo.co.in> wrote:
> > > >
> > > > set the autoincrement property of that
particular column auto-id.
> > > >
> > > >
> > > > ----- Original Message ----
> > > > From: Ian Lipsky <aspadvice2imerk.net>
> > > > To: aspnet-databasesaspadvice.com
> > > > Sent: Wednesday, 22 August, 2007
10:39:03 PM
> > > > Subject: [aspnet-databases] RE: want to
get the next ID before 
> > > > inserting
> > > >
> > > >
> > > > Sequence DB object?
> > > >
> > > > Actually, I was planning on using a
table with an auto-id field, 
> > > > and
> >
> > > > then insert a row to get the next ID and
then delete that row to 
> > > > keep the table small.
> > > >
> > > > Ian
> > > >
> > > > On 8/21/07, PhilJackson
<pjackson1hot.rr.com> wrote:
> > > > > Yep - having a column defined as an
identity (auto increment) or
> 
> > > > > using a Sequence DB object is
certainly better.  I've seen 
> > > > > Keith's
> >
> > > > > method used even in old systems
that had nothing but IBM VSAM 
> > > > > files, with one file containing
that "next number" ,etc.
> > > > >
> > > > >
> > > > >
> > > > > On Tue, 2007-08-21 at 18:08 -0600,
Keith Barrows [StarPilot]
> > wrote:
> > > > > > One of the ways we did in
"the old days" before auto generated
> 
> > > > > > IDs
> > > > were the
> > > > > > rage was to have a table that
was solely responsible for 
> > > > > > dishing
> >
> > > > > > out
> > > > new
> > > > > > IDs.  Single column for the
ID, sproc to get the next ID and 
> > > > > > increment
> > > > it.
> > > > > > Now, you have a unique ID that
no one else can ever have.  The
> 
> > > > > > only
> > > > caveat
> > > > > > is if it is thrown away:  You
end up with gaps in your
> > > > sequences.  C'est la
> > > > > > vie.
> 
> 
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
Need XML Advice?
> http://xmladvice.com
> 
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
Need XML Advice?
> http://xmladvice.com
> 
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
> Need XML Advice? http://xmladvice.com



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

RE: want to get the next ID before inserting
user name
2007-09-18 19:05:01
Phil,

Well, I think it is certainly clear you would resent it? 
LOL 


Larry Jones 
Hydrel/AcuityBrands   
 

-----Original Message-----
From: PhilJackson [mailto:pjackson1hot.rr.com] 
Sent: Thursday, September 13, 2007 9:40 PM
To: aspnet-databasesaspadvice.com
Subject: [aspnet-databases] RE: want to get the next ID
before inserting

Well,

Given such specs, you look at them and communicate back the
user your
concerns.

>From a technical perspective we can do:
A - which means.....will happen.
or
B - which means......will happen.
Which is preferable to you?

I think that whether you show some ID either at the
beginning or end of
the task, whatever it might represent, the user will latch
on to it as
"theirs"  and will resent it if some user
"X" has instead latched on to
it.  

Phil J.
 

  

On Thu, 2007-09-13 at 23:03 -0400, Jones, Larry wrote:
> Sorry for typo.  POBs shoud be PHBs (Pointy Haired
Bosses).
>
____________________________________________________________

> 
> Ken,
> 
> I understand your concerns about limiting your career,
and certainly 
> the consequences of the code should be weighed against
your current 
> working environment and incipent cash flow, harump,
harump ...
> 
> However, since we did not have details on the
environment it is hard 
> to say what would be workable.  If there was only one
person entering 
> data at a time then there would never be a problem and
my solution 
> would work perfectly for everyone.  If there was a
chance that only 
> occasionally there could be a double hit on one ID,
then it would 
> still probably work OK.  If there was massive numbers
of people 
> updating the file simultaneously then it probably
wouldn't be a good
solution.
> 
> Also, I am not sure you understood what I was
suggesting.  The number 
> returned to the user would be correct, unless someone
else came along 
> at the same time and requested a new ID also.  For the
actual adding 
> of the record there would never be an integrity problem
since it would

> use an Identity column.  If the number it ended up with
turned out to 
> be different than the previewed one I would display a
message to the 
> user immediately upon adding saying something like,
"Your preview # 
> was used by another user.  Record added with ID#
12345".
> 
> Obviously, if there was an actual need to have the ID
ahead of time, 
> like they were going off and entering the ID in another
system and 
> then going back and doing the data entry, then this
would not be
workable.
> So, when I was suggesting this as *possibility* I was
assuming there 
> was not any real need.  I also would assume that any
such scheme would

> be run by the manager for approval and not done as a
covert operation.
> 
> Believe me I understand the intricacies of
record-locking schemes.  I 
> wrote ISAM file handlers in assembly language back in
the 70's and 
> grueled over the many possibilites of data getting
messed up in 
> multi-user environments.
> 
> I was being somewhat flippant referring to the POBs,
and saying "who 
> cares", not so much out of disrespect to the
managers but in an 
> attempt to bring some levity to the scene.
> 
> Ultimately, it seems to me to be a judgement call of
how to go about a

> solution depending on factors like how many users there
are, how many 
> use the application at the same time, is there any
other processing 
> going on in another system using the ID, and lastly how
comforable you

> as a developer feel with the solution based on your
knowledge of the 
> project and relationship with other involved.
> 
> Happy Programming,
> 
> Larry Jones 
> Hydrel/AcuityBrands   
>  
> 
> -----Original Message-----
> From: Ken Schaefer [mailto:KenadOpenStatic.com]
> Sent: Thursday, September 13, 2007 9:14 AM
> To: aspnet-databasesaspadvice.com
> Subject: [aspnet-databases] RE: want to get the next ID
before 
> inserting
> 
> > Since the preview has no known purpose, who
cares.
> 
> Whilst Ian doesn't know what the purpose of the preview
is, that 
> doesn't mean that there isn't some legitimate business
need for it.
> 
> As a programmer, who's given some specs, you can't say
"I don't 
> understand why they want to do this, so I'll just do it
some other way

> that's easier for me. Who'll care?" That's usually
a career limiting 
> move in my experience.
> 
> Cheers
> Ken
> 
> 
> -----Original Message-----
> From: Jones, Larry [mailto:LJonesLithonia.com]
> Sent: Saturday, 25 August 2007 8:19 AM
> To: aspnet-databasesaspadvice.com
> Subject: [aspnet-databases] RE: want to get the next ID
before 
> inserting
> 
> BTW, I didn't suggest actually doing the insert with
the Max ID +1, 
> but just showing it as a preview for the POBs. 
> 
> If in the rare case the preview disagreed after the
insert was done a 
> little pop-up could even inform them of it, and give
the user the new 
> real ID.  Since  the preview has no known purpose, who
cares.
> 
> Larry Jones
> Hydrel/AcuityBrands
> 
> 
> -----Original Message-----
> From: PhilJackson [mailto:pjackson1hot.rr.com]
> Sent: Thursday, August 23, 2007 7:38 PM
> To: aspnet-databasesaspadvice.com
> Subject: [aspnet-databases] RE: want to get the next ID
before 
> inserting
> 
> The whole idea seems bogus, but methinks that if you
are going to show

> that ID before it is actually saved, you better insert
a row with some

> minimal info and do the update later.  Unless you are
talking about a 
> single-user desktop app,each with their own copy of the
DB.  Adding 1 
> to the max ID is horrifically bad idea.  A user could
navigate to the 
> page where that ID is displayed,go for a coffee break,
etc., come back
and
> that ID is associated with something else.   Doing the
insert
> first,you'll just potentially end up with a bunch of
incomplete bogus 
> rows and gaps in the sequence to clean up....not
knowing what the app 
> does, that would offer a way to partially complete the
process, leave 
> and come back later to finish if that ID is known? 
Only reason I can 
> see for doing this....
> 
> 
> 
> On Thu, 2007-08-23 at 21:32 -0400, Steven Smith wrote:
> > What if two people hit the Add Record page at the
same time?  They'd

> > both get the same number.  At least one of them
would be wrong.
> >
> > Steve
> >
> >
> > --
> > Steven A Smith | ASP.NET MVP | Microsoft Regional
Director 
> > President, ASPAlliance LLC | http://aspalliance.com 
> > ssmithaspalliance.com
> >
> >
> >
> >
> > -----Original Message-----
> > From: Jones, Larry [mailto:LJonesLithonia.com]
> > Sent: Thursday, August 23, 2007 9:07 PM
> > To: aspnet-databasesaspadvice.com
> > Subject: [aspnet-databases] RE: want to get the
next ID before 
> > inserting
> >
> > I am late on the thread, but I was wondering why
you didn't just 
> > return
> > MAX(ID) +1 on an auto-increment field for the
preview of the number.
> >
> >
> > Larry Jones
> > Hydrel/AcuityBrands
> >
> >
> > -----Original Message-----
> > From: merkimerk.com [mailto:merkimerk.com] On Behalf Of Ian Lipsky
> > Sent: Thursday, August 23, 2007 10:26 AM
> > To: aspnet-databasesaspadvice.com
> > Subject: [aspnet-databases] RE: want to get the
next ID before 
> > inserting
> >
> > Yes, thanks. I know about that. I know how to get
the id of an 
> > inserted record. I was just wondering if there
were a better way 
> > other
> 
> > then 'wasting' a table just to get ID numbers.
> >
> > thanks to everyone. I've already implemented
this.
> >
> > Ian
> >
> > On 8/23/07, Reji Gopalakrishnan <rejigopugmail.com> wrote:
> > > HI
> > >
> > > In DB SP after insert get scopeidentity value
and retrun that to 
> > > .net page
> > >
> > > Rej
> > >
> > > On 8/23/07, ravi pinnoju <ravi_pinnojuyahoo.co.in> wrote:
> > > >
> > > > set the autoincrement property of that
particular column
auto-id.
> > > >
> > > >
> > > > ----- Original Message ----
> > > > From: Ian Lipsky <aspadvice2imerk.net>
> > > > To: aspnet-databasesaspadvice.com
> > > > Sent: Wednesday, 22 August, 2007
10:39:03 PM
> > > > Subject: [aspnet-databases] RE: want to
get the next ID before 
> > > > inserting
> > > >
> > > >
> > > > Sequence DB object?
> > > >
> > > > Actually, I was planning on using a
table with an auto-id field,

> > > > and
> >
> > > > then insert a row to get the next ID and
then delete that row to

> > > > keep the table small.
> > > >
> > > > Ian
> > > >
> > > > On 8/21/07, PhilJackson
<pjackson1hot.rr.com> wrote:
> > > > > Yep - having a column defined as an
identity (auto increment) 
> > > > > or
> 
> > > > > using a Sequence DB object is
certainly better.  I've seen 
> > > > > Keith's
> >
> > > > > method used even in old systems
that had nothing but IBM VSAM 
> > > > > files, with one file containing
that "next number" ,etc.
> > > > >
> > > > >
> > > > >
> > > > > On Tue, 2007-08-21 at 18:08 -0600,
Keith Barrows [StarPilot]
> > wrote:
> > > > > > One of the ways we did in
"the old days" before auto 
> > > > > > generated
> 
> > > > > > IDs
> > > > were the
> > > > > > rage was to have a table that
was solely responsible for 
> > > > > > dishing
> >
> > > > > > out
> > > > new
> > > > > > IDs.  Single column for the
ID, sproc to get the next ID and

> > > > > > increment
> > > > it.
> > > > > > Now, you have a unique ID that
no one else can ever have.  
> > > > > > The
> 
> > > > > > only
> > > > caveat
> > > > > > is if it is thrown away:  You
end up with gaps in your
> > > > sequences.  C'est la
> > > > > > vie.
> 
> 
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
Need XML Advice?
> http://xmladvice.com
> 
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
Need XML Advice?
> http://xmladvice.com
> 
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
Need XML Advice? 
> http://xmladvice.com



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice?
http://xmladvice.com


Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice?
http://xmladvice.com

Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )