Click here to Skip to main content
15,916,945 members
Home / Discussions / Database
   

Database

 
GeneralDisplay Row Number Pin
Jason Weibel10-Oct-02 9:30
Jason Weibel10-Oct-02 9:30 
GeneralRe: Display Row Number Pin
Michael P Butler10-Oct-02 9:58
Michael P Butler10-Oct-02 9:58 
GeneralRe: Display Row Number Pin
Jason Weibel10-Oct-02 10:03
Jason Weibel10-Oct-02 10:03 
GeneralRe: Display Row Number Pin
Robby10-Oct-02 10:35
Robby10-Oct-02 10:35 
GeneralRe: Display Row Number Pin
Carlos Antollini10-Oct-02 10:44
Carlos Antollini10-Oct-02 10:44 
GeneralRe: Display Row Number Pin
Rein Hillmann14-Oct-02 22:30
Rein Hillmann14-Oct-02 22:30 
GeneralRe: Display Row Number Pin
Rein Hillmann14-Oct-02 22:50
Rein Hillmann14-Oct-02 22:50 
QuestionCan I SELECT information the same time i INSERT Pin
Robby10-Oct-02 9:04
Robby10-Oct-02 9:04 
I want to know if there is a way to get the PK from a row the minute I insert information. Here's the scenario, what's the most efficient way of doing this?

1. I have 50 tables that represent 50 HTML forms.
2. I am inserting results from OnlineAccess.asp into dbo.OnlineAccess.
3. I am keeping all dateTime stamps along with the status of the request (OPEN, BEING PROCESSED, COMPLETE) in another table called dateTime.
4. I want to get the PK of the information entered into dbo.OnlineAccess so that I can insert this into dbo.DateTime for relation to dbo.OnlineAccess's information.

Is there any "bi-di" capabilities that can be used to return the PK without having to run another line of code to SELECT the PK WHERE <and then="" pass="" results="" of="" the="" form="" back="" again="">. For instance, I know I can do it this way, but it seems like too much leg work:

sqlInsert = "INSERT into OnlineAccess(userID,lastName,firstName,...) values('"&userID&"','"&lastName&"','"&firstName&"',...)"

sqlSelect = "SELECT requestID FROM OnlineAccess WHERE userID='"&userID&"' AND lastName='"&lastName&"' AND ..."
RS = MyConn.Execute(sqlSelect)
requestID = RS("requestID")

sqlInsert = "INSERT into DateTime (requestID,status) values('"&requestID&"','OPEN')"

(I have a trigger that takes care of the dateTime stamps based on the status)

Can anyone help me on this one? Thanks in advance!
Robby
AnswerRe: Can I SELECT information the same time i INSERT Pin
David Salter10-Oct-02 9:56
David Salter10-Oct-02 9:56 
AnswerRe: Can I SELECT information the same time i INSERT Pin
Jon Hulatt10-Oct-02 22:05
Jon Hulatt10-Oct-02 22:05 
GeneralADO Command->Execute throws exception Pin
ssirisha10-Oct-02 5:55
ssirisha10-Oct-02 5:55 
GeneralRe: ADO Command->Execute throws exception Pin
Carlos Antollini10-Oct-02 6:22
Carlos Antollini10-Oct-02 6:22 
GeneralRe: ADO Command->Execute throws exception Pin
ssirisha10-Oct-02 7:01
ssirisha10-Oct-02 7:01 
GeneralRe: ADO Command->Execute throws exception Pin
Carlos Antollini10-Oct-02 8:20
Carlos Antollini10-Oct-02 8:20 
QuestionHow to select 1 entry without using "top 1" in SQL query? Pin
Segal8-Oct-02 14:47
Segal8-Oct-02 14:47 
AnswerRe: How to select 1 entry without using "top 1" in SQL query? Pin
Paul Riley8-Oct-02 14:54
Paul Riley8-Oct-02 14:54 
GeneralRe: How to select 1 entry without using "top 1" in SQL query? Pin
Anonymous8-Oct-02 16:19
Anonymous8-Oct-02 16:19 
GeneralRe: How to select 1 entry without using "top 1" in SQL query? Pin
Jon Hulatt9-Oct-02 0:34
Jon Hulatt9-Oct-02 0:34 
GeneralRe: How to select 1 entry without using "top 1" in SQL query? Pin
Nick Parker9-Oct-02 1:43
protectorNick Parker9-Oct-02 1:43 
QuestionUpdating Access Queries using SQL? Pin
Paul Riley8-Oct-02 14:24
Paul Riley8-Oct-02 14:24 
AnswerRe: Updating Access Queries using SQL? Pin
Mazdak9-Oct-02 9:21
Mazdak9-Oct-02 9:21 
GeneralRe: Updating Access Queries using SQL? Pin
Paul Riley9-Oct-02 11:45
Paul Riley9-Oct-02 11:45 
AnswerRe: Updating Access Queries using SQL? Pin
Mazdak9-Oct-02 23:12
Mazdak9-Oct-02 23:12 
GeneralRe: Updating Access Queries using SQL? Pin
Paul Riley9-Oct-02 23:36
Paul Riley9-Oct-02 23:36 
GeneralOutput Nested Set Model to XML using MS SQL2K Pin
Ingram Leedy8-Oct-02 9:34
Ingram Leedy8-Oct-02 9:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.