|
| |
|
|
Guest
|
how can i display the record id... - 3/14/2001 18:07:00
after a record is submitted, i want to display its id and the content of this just-submitted-record...please tell me how... thanks people.
|
|
|
|
Vince from Spain
Posts: 658 From: Madrid Spain Status: offline
|
RE: how can i display the record id... - 3/15/2001 20:29:00
Hi there,here is one technique . . . RS.Open tableName, yourAlreadyOpenConnection, adOpenKeySet, adLockOptimistic, adCmdTable RS.AddNew RS("field1") = value1 RS("field2") = value2 ... RS("fieldN") = valueN RS.Update idOfAddedRecord = RS("nameOfAutonumberField") Here is another. This code is executed AFTER adding your new record.
SQL = "SELECT @@IDENTITY" Set RS = Server.CreateObject("ADODB.RecordSet") RS.Open SQL, Connection, adOpenForwardOnly, adLockReadOnly, adCmdText Set RS = Connection.Execute(SQL) jobID = RS(0).Value RS.Close Set RS = nothing The first technique is very much preferred as the second can be fooled in a multi-user environment. By that I mean that if 2 people are accesing you web-page at exactly the same time, one could end up displaying the others id field.
All the best Vince
------------------ Internet Business Solutions S.L.(Spain)
|
|
|
|
markjlawrence
Posts: 119 From: Belfast Northern Ireland Status: offline
|
RE: how can i display the record id... - 3/18/2001 15:27:00
Hi Vince,What if you are using FrontPage's built in database connection? I don't think I can modify that without FrontPage saying "Contents will be overwritten when saved". Is your suggested method above, the only solution? thanks, Mark.
|
|
|
|
momof4boys
Posts: 21 From: None Status: offline
|
RE: how can i display the record id... - 3/19/2001 20:21:00
If you are talking about what I think you are talking about Front Page generates a confirmation for when information is uploaded into your database. If that form is not showing after you hit the submit button then your form properties are not set correctly and the information isn't being sent to the database. OR You may be talking about something else. I have information being sent to my database via a form and I display it via database results. In Front Page2000 just click on Insert then on database then on results and go from there.If neither of those are what you are talking about then I don't have the answer and I wish you luck either way!
|
|
|
|
Vince from Spain
Posts: 658 From: Madrid Spain Status: offline
|
RE: how can i display the record id... - 3/20/2001 23:36:00
Hi Mark, I just had a look, and I can't see any way to get the autonumeric id field using the DRW. As you say, FP is just going to overwrite the changes you make. I would go for hand-coded ASP for this one, but maybe others have a better idea.All the best Vince
------------------ Internet Business Solutions S.L.(Spain)
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|