Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > how to get row just inserted

Reply
Thread Tools

how to get row just inserted

 
 
middletree
Guest
Posts: n/a
 
      12-12-2003
ASP 3 and Access 2000. I have a page which enters a row into a table, and
then enters some other info into another table. Problem is, I need to do the
first one, then obtain the PK, which is an Autonumber, so I can enter it
into the other table.

I know how to do this in SQL Server with identity columns, but this is
Access. (I know Access is not very good, but I have to use it for this
church project.)

Here's my code:

strFName = Replace(Trim(Request.Form("FName")),"'","''")
etc.

strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=[etc]"
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnection
objConnection.Open
strSQL = "INSERT INTO Personal(etc) "
strSQL = strSQL & "VALUES(etc) "
objConnection.Execute strSQL

So now I need to do a SELECT from the Personal table, then enter that into
the table which consists of 2 fields, both of which are FK's for other
tables (this table was put in to resolve a many-to-many relationship)

FWIW, I'm doing this in a loop; that is, I have a variable number of
checkboxes, and for each one checked by the user, I'll have to insert a row
into this 2nd table. One one entry into the first table, though.

Any help would be appreciated.




 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      12-12-2003

"middletree" <> wrote in message
news:...
> ASP 3 and Access 2000. I have a page which enters a row into a table, and
> then enters some other info into another table. Problem is, I need to do

the
> first one, then obtain the PK, which is an Autonumber, so I can enter it
> into the other table.


http://www.aspfaq.com/show.asp?id=2174

Ray at home


 
Reply With Quote
 
 
 
 
middletree
Guest
Posts: n/a
 
      12-12-2003
Dang! I usually go to aspfaq first, but didn't do it this time. Thanks!


"Ray at <%=sLocation%>" <myFirstNameATlane34dotKOMM> wrote in message
news:...
>
> "middletree" <> wrote in message
> news:...
> > ASP 3 and Access 2000. I have a page which enters a row into a table,

and
> > then enters some other info into another table. Problem is, I need to do

> the
> > first one, then obtain the PK, which is an Autonumber, so I can enter it
> > into the other table.

>
> http://www.aspfaq.com/show.asp?id=2174
>
> Ray at home
>
>



 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
HOWTO: FormView Insert Operation - Get Row ID of Inserted Row Dan Sikorsky ASP .Net 2 04-30-2009 09:50 PM
ok I can do a totals row but how about a percentage row after each data row D ASP .Net Datagrid Control 0 05-23-2005 04:10 PM
Adding Rows Dynamically into the Table Web Control but only one row is getting inserted lucky ASP .Net 0 01-12-2005 10:45 AM
Best way to get ID of inserted row?? =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?= ASP .Net 4 11-17-2004 10:39 AM



Advertisments