Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Detecting ID of just written DB entry !

Reply
Thread Tools

Detecting ID of just written DB entry !

 
 
Jake
Guest
Posts: n/a
 
      09-25-2003
I have a DB with 3 fields.
ID
Name
EMail

If I write an entry into this DB, Name and EMail, the ID is auto
increment.

How can I detect what ID has been created ?

I want a user to submit details to me, they get the ID as a ticket
number ?

How can I do this ?

Thanks
 
Reply With Quote
 
 
 
 
Bertrand
Guest
Posts: n/a
 
      09-25-2003
once the table has been updated, you can run a query with
with Max(ID ) to retrieve the highest (and therefor last)
ID entered in the ID ... because more than one user can
add themselves, there is a chance that the answer is
actually not correct ... so you need to first retrieve the
Max ID then check that the name + email match the ones for
that ID and if not then just do Max(ID) - 1 or -2 etc
until you find the right combination ...
or you could just run a query bla bla Where Name =
request.form("Name") AND Email = request.form("Email") ...
the odds of 2 users with same name + same email is very
slim of course ... so the second solution is proably
better ...

HTH,

Bertrand


>-----Original Message-----
>I have a DB with 3 fields.
>ID
>Name
>EMail
>
>If I write an entry into this DB, Name and EMail, the ID

is auto
>increment.
>
>How can I detect what ID has been created ?
>
>I want a user to submit details to me, they get the ID as

a ticket
>number ?
>
>How can I do this ?
>
>Thanks
>.
>

 
Reply With Quote
 
 
 
 
only_me
Guest
Posts: n/a
 
      09-25-2003
see http://www.aspfaq.com/show.asp?id=2174
Shame you can't have 'sticky' posts in a newsgroup

<jake @ yono.com (Jake)> wrote in message
news:(E-Mail Removed)...
> I have a DB with 3 fields.
> ID
> Name
> EMail
>
> If I write an entry into this DB, Name and EMail, the ID is auto
> increment.
>
> How can I detect what ID has been created ?
>
> I want a user to submit details to me, they get the ID as a ticket
> number ?
>
> How can I do this ?
>
> Thanks



 
Reply With Quote
 
Jake
Guest
Posts: n/a
 
      09-25-2003
Thaks to all !

On Thu, 25 Sep 2003 10:12:52 +0100, "only_me" <(E-Mail Removed)>
wrote:

>see http://www.aspfaq.com/show.asp?id=2174
>Shame you can't have 'sticky' posts in a newsgroup
>
><jake @ yono.com (Jake)> wrote in message
>news:(E-Mail Removed)...
>> I have a DB with 3 fields.
>> ID
>> Name
>> EMail
>>
>> If I write an entry into this DB, Name and EMail, the ID is auto
>> increment.
>>
>> How can I detect what ID has been created ?
>>
>> I want a user to submit details to me, they get the ID as a ticket
>> number ?
>>
>> How can I do this ?
>>
>> Thanks

>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generally, are the programs written by C++ slower than written by C10% ? KaiWen C++ 102 09-14-2011 11:12 PM
Form field entry directs to diff URLs based on entry? AtomicBob HTML 14 05-02-2006 07:07 AM
Need a method for detecting when files are written to a directory Elliott Java 12 09-25-2004 05:45 AM
Default text written to event log entry - how to remove? Rob Meade ASP .Net 0 04-27-2004 08:30 AM
Re: Can a usercontrol written in C# be used in Web Forms that is written in VB.Net? Steve C. Orr, MCSD ASP .Net 1 08-24-2003 12:06 AM



Advertisments